Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 134 | ALC269_ASUS_EEEPC_P703, |
| 135 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 136 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 137 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 138 | ALC269_AUTO, |
| 139 | ALC269_MODEL_LAST /* last tag */ |
| 140 | }; |
| 141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | /* ALC861 models */ |
| 143 | enum { |
| 144 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 145 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | ALC861_3ST_DIG, |
| 147 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 148 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 149 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 150 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 151 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 152 | ALC861_AUTO, |
| 153 | ALC861_MODEL_LAST, |
| 154 | }; |
| 155 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 156 | /* ALC861-VD models */ |
| 157 | enum { |
| 158 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 159 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 160 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 161 | ALC861VD_3ST, |
| 162 | ALC861VD_3ST_DIG, |
| 163 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 164 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 165 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 166 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 167 | ALC861VD_AUTO, |
| 168 | ALC861VD_MODEL_LAST, |
| 169 | }; |
| 170 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 171 | /* ALC662 models */ |
| 172 | enum { |
| 173 | ALC662_3ST_2ch_DIG, |
| 174 | ALC662_3ST_6ch_DIG, |
| 175 | ALC662_3ST_6ch, |
| 176 | ALC662_5ST_DIG, |
| 177 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 178 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 179 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 180 | ALC663_ASUS_M51VA, |
| 181 | ALC663_ASUS_G71V, |
| 182 | ALC663_ASUS_H13, |
| 183 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 184 | ALC662_ECS, |
| 185 | ALC663_ASUS_MODE1, |
| 186 | ALC662_ASUS_MODE2, |
| 187 | ALC663_ASUS_MODE3, |
| 188 | ALC663_ASUS_MODE4, |
| 189 | ALC663_ASUS_MODE5, |
| 190 | ALC663_ASUS_MODE6, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 191 | ALC272_DELL, |
| 192 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 193 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 194 | ALC662_AUTO, |
| 195 | ALC662_MODEL_LAST, |
| 196 | }; |
| 197 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 198 | /* ALC882 models */ |
| 199 | enum { |
| 200 | ALC882_3ST_DIG, |
| 201 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 202 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 203 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 204 | ALC882_TARGA, |
| 205 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 206 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 207 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 208 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 209 | ALC885_MB5, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 210 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 211 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | ALC882_MODEL_LAST, |
| 213 | }; |
| 214 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 215 | /* ALC883 models */ |
| 216 | enum { |
| 217 | ALC883_3ST_2ch_DIG, |
| 218 | ALC883_3ST_6ch_DIG, |
| 219 | ALC883_3ST_6ch, |
| 220 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 221 | ALC883_TARGA_DIG, |
| 222 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 223 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 224 | ALC883_ACER, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 225 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 226 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 227 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_8930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 229 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 230 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 231 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 232 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 233 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 234 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 235 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 236 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 237 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 238 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 239 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 240 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 241 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 242 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 243 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 244 | ALC888_ASUS_M90V, |
| 245 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 246 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 247 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 248 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 249 | ALC883_AUTO, |
| 250 | ALC883_MODEL_LAST, |
| 251 | }; |
| 252 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 253 | /* styles of capture selection */ |
| 254 | enum { |
| 255 | CAPT_MUX = 0, /* only mux based */ |
| 256 | CAPT_MIX, /* only mixer based */ |
| 257 | CAPT_1MUX_MIX, /* first mux and other mixers */ |
| 258 | }; |
| 259 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 260 | /* for GPIO Poll */ |
| 261 | #define GPIO_MASK 0x03 |
| 262 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 263 | /* extra amp-initialization sequence types */ |
| 264 | enum { |
| 265 | ALC_INIT_NONE, |
| 266 | ALC_INIT_DEFAULT, |
| 267 | ALC_INIT_GPIO1, |
| 268 | ALC_INIT_GPIO2, |
| 269 | ALC_INIT_GPIO3, |
| 270 | }; |
| 271 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | struct alc_spec { |
| 273 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 274 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 276 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 277 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 279 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 280 | * don't forget NULL |
| 281 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 282 | */ |
| 283 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 285 | char stream_name_analog[16]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | struct hda_pcm_stream *stream_analog_playback; |
| 287 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 288 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 289 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 291 | char stream_name_digital[16]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | struct hda_pcm_stream *stream_digital_playback; |
| 293 | struct hda_pcm_stream *stream_digital_capture; |
| 294 | |
| 295 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 296 | struct hda_multi_out multiout; /* playback set-up |
| 297 | * max_channels, dacs must be set |
| 298 | * dig_out_nid and hp_nid are optional |
| 299 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 300 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 301 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 302 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
| 304 | /* capture */ |
| 305 | unsigned int num_adc_nids; |
| 306 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 307 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 308 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 309 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | |
| 311 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 312 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | const struct hda_input_mux *input_mux; |
| 314 | unsigned int cur_mux[3]; |
| 315 | |
| 316 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 317 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 319 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 320 | int const_channel_count; |
| 321 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
| 323 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 324 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 325 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 326 | /* dynamic controls, init_verbs and input_mux */ |
| 327 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 328 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 329 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 330 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 331 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 332 | /* hooks */ |
| 333 | void (*init_hook)(struct hda_codec *codec); |
| 334 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 335 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 336 | /* for pin sensing */ |
| 337 | unsigned int sense_updated: 1; |
| 338 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 339 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 340 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 341 | /* other flags */ |
| 342 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 343 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 344 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 345 | /* for virtual master */ |
| 346 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 347 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 348 | struct hda_loopback_check loopback; |
| 349 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 350 | |
| 351 | /* for PLL fix */ |
| 352 | hda_nid_t pll_nid; |
| 353 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 354 | }; |
| 355 | |
| 356 | /* |
| 357 | * configuration template - to be copied to the spec instance |
| 358 | */ |
| 359 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 360 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 361 | * with spec |
| 362 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 363 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 364 | const struct hda_verb *init_verbs[5]; |
| 365 | unsigned int num_dacs; |
| 366 | hda_nid_t *dac_nids; |
| 367 | hda_nid_t dig_out_nid; /* optional */ |
| 368 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 369 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 370 | unsigned int num_adc_nids; |
| 371 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 372 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 373 | hda_nid_t dig_in_nid; |
| 374 | unsigned int num_channel_mode; |
| 375 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 376 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 377 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 378 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 379 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 380 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 381 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 382 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 383 | struct hda_amp_list *loopbacks; |
| 384 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | }; |
| 386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | |
| 388 | /* |
| 389 | * input MUX handling |
| 390 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 391 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 392 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | { |
| 394 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 395 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 396 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 397 | if (mux_idx >= spec->num_mux_defs) |
| 398 | mux_idx = 0; |
| 399 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | } |
| 401 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 402 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 403 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | { |
| 405 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 406 | struct alc_spec *spec = codec->spec; |
| 407 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 408 | |
| 409 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 410 | return 0; |
| 411 | } |
| 412 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 413 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 414 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | { |
| 416 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 417 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 418 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 420 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 421 | hda_nid_t nid = spec->capsrc_nids ? |
| 422 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 424 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 425 | imux = &spec->input_mux[mux_idx]; |
| 426 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 427 | if (spec->capture_style && |
| 428 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 429 | /* Matrix-mixer style (e.g. ALC882) */ |
| 430 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 431 | unsigned int i, idx; |
| 432 | |
| 433 | idx = ucontrol->value.enumerated.item[0]; |
| 434 | if (idx >= imux->num_items) |
| 435 | idx = imux->num_items - 1; |
| 436 | if (*cur_val == idx) |
| 437 | return 0; |
| 438 | for (i = 0; i < imux->num_items; i++) { |
| 439 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 440 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 441 | imux->items[i].index, |
| 442 | HDA_AMP_MUTE, v); |
| 443 | } |
| 444 | *cur_val = idx; |
| 445 | return 1; |
| 446 | } else { |
| 447 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 448 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 449 | &spec->cur_mux[adc_idx]); |
| 450 | } |
| 451 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 452 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | /* |
| 454 | * channel mode setting |
| 455 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 456 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 457 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | { |
| 459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 460 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 461 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 462 | spec->num_channel_mode); |
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_get(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 | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 470 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 471 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 472 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | } |
| 474 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 475 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 476 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | { |
| 478 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 479 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 480 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 481 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 482 | &spec->ext_channel_count); |
| 483 | if (err >= 0 && !spec->const_channel_count) { |
| 484 | spec->multiout.max_channels = spec->ext_channel_count; |
| 485 | if (spec->need_dac_fix) |
| 486 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 487 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 488 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | } |
| 490 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 492 | * 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] | 493 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 494 | * being part of a format specifier. Maximum allowed length of a value is |
| 495 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 496 | * |
| 497 | * Note: some retasking pin complexes seem to ignore requests for input |
| 498 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 499 | * are requested. Therefore order this list so that this behaviour will not |
| 500 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 501 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 502 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 503 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 504 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 505 | "Mic 50pc bias", "Mic 80pc bias", |
| 506 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 507 | }; |
| 508 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 509 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 510 | }; |
| 511 | /* 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] | 512 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 513 | * addition, "input" pins may or may not process the mic bias option |
| 514 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 515 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 516 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 517 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 518 | #define ALC_PIN_DIR_IN 0x00 |
| 519 | #define ALC_PIN_DIR_OUT 0x01 |
| 520 | #define ALC_PIN_DIR_INOUT 0x02 |
| 521 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 522 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 523 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 524 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 525 | * For each direction the minimum and maximum values are given. |
| 526 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 527 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 529 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 530 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 531 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 532 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | }; |
| 534 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 535 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 536 | #define alc_pin_mode_n_items(_dir) \ |
| 537 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 538 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 539 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 540 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 541 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 542 | unsigned int item_num = uinfo->value.enumerated.item; |
| 543 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 544 | |
| 545 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 546 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 547 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 548 | |
| 549 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 550 | item_num = alc_pin_mode_min(dir); |
| 551 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 552 | return 0; |
| 553 | } |
| 554 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 556 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 557 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 558 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 559 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 560 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 562 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 563 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 564 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 565 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 566 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 567 | /* Find enumerated value for current pinctl setting */ |
| 568 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 569 | 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] | 570 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 571 | *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] | 572 | return 0; |
| 573 | } |
| 574 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 575 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 576 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | { |
| 578 | signed int change; |
| 579 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 580 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 581 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 582 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 583 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 584 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 585 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 586 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 587 | 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] | 588 | val = alc_pin_mode_min(dir); |
| 589 | |
| 590 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 591 | if (change) { |
| 592 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 593 | snd_hda_codec_write_cache(codec, nid, 0, |
| 594 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 595 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 596 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 597 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 598 | * for the requested pin mode. Enum values of 2 or less are |
| 599 | * input modes. |
| 600 | * |
| 601 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 602 | * reduces noise slightly (particularly on input) so we'll |
| 603 | * do it. However, having both input and output buffers |
| 604 | * enabled simultaneously doesn't seem to be problematic if |
| 605 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 606 | */ |
| 607 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 608 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 609 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 610 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 611 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 612 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 613 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 614 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 615 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 616 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 617 | } |
| 618 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 619 | return change; |
| 620 | } |
| 621 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 622 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 623 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 624 | .info = alc_pin_mode_info, \ |
| 625 | .get = alc_pin_mode_get, \ |
| 626 | .put = alc_pin_mode_put, \ |
| 627 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 628 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 629 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 630 | * together using a mask with more than one bit set. This control is |
| 631 | * currently used only by the ALC260 test model. At this stage they are not |
| 632 | * needed for any "production" models. |
| 633 | */ |
| 634 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 635 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 636 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 637 | static int alc_gpio_data_get(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 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 641 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 642 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 643 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 644 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 645 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 646 | |
| 647 | *valp = (val & mask) != 0; |
| 648 | return 0; |
| 649 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 650 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 651 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 652 | { |
| 653 | signed int change; |
| 654 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 655 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 656 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 657 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 658 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 659 | AC_VERB_GET_GPIO_DATA, |
| 660 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 661 | |
| 662 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 663 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 664 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 665 | gpio_data &= ~mask; |
| 666 | else |
| 667 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 668 | snd_hda_codec_write_cache(codec, nid, 0, |
| 669 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 670 | |
| 671 | return change; |
| 672 | } |
| 673 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 674 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 675 | .info = alc_gpio_data_info, \ |
| 676 | .get = alc_gpio_data_get, \ |
| 677 | .put = alc_gpio_data_put, \ |
| 678 | .private_value = nid | (mask<<16) } |
| 679 | #endif /* CONFIG_SND_DEBUG */ |
| 680 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 681 | /* A switch control to allow the enabling of the digital IO pins on the |
| 682 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 683 | * to provide something in the test model allowing digital outputs to be |
| 684 | * identified if present. If models are found which can utilise these |
| 685 | * outputs a more complete mixer control can be devised for those models if |
| 686 | * necessary. |
| 687 | */ |
| 688 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 689 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 690 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 691 | static int alc_spdif_ctrl_get(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 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 695 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 696 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 697 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 698 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 699 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 700 | |
| 701 | *valp = (val & mask) != 0; |
| 702 | return 0; |
| 703 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 704 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 705 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 706 | { |
| 707 | signed int change; |
| 708 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 709 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 710 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 711 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 712 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 713 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 714 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 715 | |
| 716 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 717 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 718 | if (val==0) |
| 719 | ctrl_data &= ~mask; |
| 720 | else |
| 721 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 722 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 723 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 724 | |
| 725 | return change; |
| 726 | } |
| 727 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 728 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 729 | .info = alc_spdif_ctrl_info, \ |
| 730 | .get = alc_spdif_ctrl_get, \ |
| 731 | .put = alc_spdif_ctrl_put, \ |
| 732 | .private_value = nid | (mask<<16) } |
| 733 | #endif /* CONFIG_SND_DEBUG */ |
| 734 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 735 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 736 | * Again, this is only used in the ALC26x test models to help identify when |
| 737 | * the EAPD line must be asserted for features to work. |
| 738 | */ |
| 739 | #ifdef CONFIG_SND_DEBUG |
| 740 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 741 | |
| 742 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 743 | struct snd_ctl_elem_value *ucontrol) |
| 744 | { |
| 745 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 746 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 747 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 748 | long *valp = ucontrol->value.integer.value; |
| 749 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 750 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 751 | |
| 752 | *valp = (val & mask) != 0; |
| 753 | return 0; |
| 754 | } |
| 755 | |
| 756 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 757 | struct snd_ctl_elem_value *ucontrol) |
| 758 | { |
| 759 | int change; |
| 760 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 761 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 762 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 763 | long val = *ucontrol->value.integer.value; |
| 764 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 765 | AC_VERB_GET_EAPD_BTLENABLE, |
| 766 | 0x00); |
| 767 | |
| 768 | /* Set/unset the masked control bit(s) as needed */ |
| 769 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 770 | if (!val) |
| 771 | ctrl_data &= ~mask; |
| 772 | else |
| 773 | ctrl_data |= mask; |
| 774 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 775 | ctrl_data); |
| 776 | |
| 777 | return change; |
| 778 | } |
| 779 | |
| 780 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 781 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 782 | .info = alc_eapd_ctrl_info, \ |
| 783 | .get = alc_eapd_ctrl_get, \ |
| 784 | .put = alc_eapd_ctrl_put, \ |
| 785 | .private_value = nid | (mask<<16) } |
| 786 | #endif /* CONFIG_SND_DEBUG */ |
| 787 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 788 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 789 | * set up the input pin config (depending on the given auto-pin type) |
| 790 | */ |
| 791 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 792 | int auto_pin_type) |
| 793 | { |
| 794 | unsigned int val = PIN_IN; |
| 795 | |
| 796 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 797 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 798 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 799 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 800 | if (pincap & AC_PINCAP_VREF_80) |
| 801 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 802 | else if (pincap & AC_PINCAP_VREF_50) |
| 803 | val = PIN_VREF50; |
| 804 | else if (pincap & AC_PINCAP_VREF_100) |
| 805 | val = PIN_VREF100; |
| 806 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 807 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 808 | } |
| 809 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 810 | } |
| 811 | |
| 812 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 813 | */ |
| 814 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 815 | { |
| 816 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 817 | return; |
| 818 | spec->mixers[spec->num_mixers++] = mix; |
| 819 | } |
| 820 | |
| 821 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 822 | { |
| 823 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 824 | return; |
| 825 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 826 | } |
| 827 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 828 | #ifdef CONFIG_PROC_FS |
| 829 | /* |
| 830 | * hook for proc |
| 831 | */ |
| 832 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 833 | struct hda_codec *codec, hda_nid_t nid) |
| 834 | { |
| 835 | int coeff; |
| 836 | |
| 837 | if (nid != 0x20) |
| 838 | return; |
| 839 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 840 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 841 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 842 | AC_VERB_GET_COEF_INDEX, 0); |
| 843 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 844 | } |
| 845 | #else |
| 846 | #define print_realtek_coef NULL |
| 847 | #endif |
| 848 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 849 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 850 | * set up from the preset table |
| 851 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 852 | static void setup_preset(struct alc_spec *spec, |
| 853 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 854 | { |
| 855 | int i; |
| 856 | |
| 857 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 858 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 859 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 860 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 861 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 862 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 863 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 864 | spec->channel_mode = preset->channel_mode; |
| 865 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 866 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 867 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 868 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 869 | if (preset->const_channel_count) |
| 870 | spec->multiout.max_channels = preset->const_channel_count; |
| 871 | else |
| 872 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 873 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 874 | |
| 875 | spec->multiout.num_dacs = preset->num_dacs; |
| 876 | spec->multiout.dac_nids = preset->dac_nids; |
| 877 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 878 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 879 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 880 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 881 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 882 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 883 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 884 | spec->input_mux = preset->input_mux; |
| 885 | |
| 886 | spec->num_adc_nids = preset->num_adc_nids; |
| 887 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 888 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 889 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 890 | |
| 891 | spec->unsol_event = preset->unsol_event; |
| 892 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 893 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 894 | spec->loopback.amplist = preset->loopbacks; |
| 895 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 896 | } |
| 897 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 898 | /* Enable GPIO mask and set output */ |
| 899 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 900 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 901 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 902 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 903 | { } |
| 904 | }; |
| 905 | |
| 906 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 907 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 908 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 909 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 910 | { } |
| 911 | }; |
| 912 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 913 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 914 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 915 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 916 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 917 | { } |
| 918 | }; |
| 919 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 920 | /* |
| 921 | * Fix hardware PLL issue |
| 922 | * On some codecs, the analog PLL gating control must be off while |
| 923 | * the default value is 1. |
| 924 | */ |
| 925 | static void alc_fix_pll(struct hda_codec *codec) |
| 926 | { |
| 927 | struct alc_spec *spec = codec->spec; |
| 928 | unsigned int val; |
| 929 | |
| 930 | if (!spec->pll_nid) |
| 931 | return; |
| 932 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 933 | spec->pll_coef_idx); |
| 934 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 935 | AC_VERB_GET_PROC_COEF, 0); |
| 936 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 937 | spec->pll_coef_idx); |
| 938 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 939 | val & ~(1 << spec->pll_coef_bit)); |
| 940 | } |
| 941 | |
| 942 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 943 | unsigned int coef_idx, unsigned int coef_bit) |
| 944 | { |
| 945 | struct alc_spec *spec = codec->spec; |
| 946 | spec->pll_nid = nid; |
| 947 | spec->pll_coef_idx = coef_idx; |
| 948 | spec->pll_coef_bit = coef_bit; |
| 949 | alc_fix_pll(codec); |
| 950 | } |
| 951 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 952 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 953 | { |
| 954 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 955 | unsigned int present; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 956 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 957 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 958 | |
| 959 | /* need to execute and sync at first */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 960 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 961 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 962 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 963 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 964 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 965 | nid = spec->autocfg.speaker_pins[i]; |
| 966 | if (!nid) |
| 967 | break; |
| 968 | snd_hda_codec_write(codec, nid, 0, |
| 969 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 970 | spec->jack_present ? 0 : PIN_OUT); |
| 971 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 972 | } |
| 973 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 974 | #if 0 /* it's broken in some cases -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 975 | static void alc_mic_automute(struct hda_codec *codec) |
| 976 | { |
| 977 | struct alc_spec *spec = codec->spec; |
| 978 | unsigned int present; |
| 979 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 980 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 981 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 982 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 983 | |
| 984 | capsrc_idx_mic = mic_nid - 0x18; |
| 985 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 986 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 987 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 988 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 989 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 990 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 991 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 992 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 993 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 994 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 995 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 996 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 997 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 998 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 999 | /* unsolicited event for HP jack sensing */ |
| 1000 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1001 | { |
| 1002 | if (codec->vendor_id == 0x10ec0880) |
| 1003 | res >>= 28; |
| 1004 | else |
| 1005 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1006 | switch (res) { |
| 1007 | case ALC880_HP_EVENT: |
| 1008 | alc_automute_pin(codec); |
| 1009 | break; |
| 1010 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1011 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1012 | break; |
| 1013 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1014 | } |
| 1015 | |
| 1016 | static void alc_inithook(struct hda_codec *codec) |
| 1017 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1018 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1019 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1020 | } |
| 1021 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1022 | /* additional initialization for ALC888 variants */ |
| 1023 | static void alc888_coef_init(struct hda_codec *codec) |
| 1024 | { |
| 1025 | unsigned int tmp; |
| 1026 | |
| 1027 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1028 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1029 | 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] | 1030 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1031 | /* alc888S-VC */ |
| 1032 | snd_hda_codec_read(codec, 0x20, 0, |
| 1033 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1034 | else |
| 1035 | /* alc888-VB */ |
| 1036 | snd_hda_codec_read(codec, 0x20, 0, |
| 1037 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1038 | } |
| 1039 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1040 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1041 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1042 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1043 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1044 | switch (type) { |
| 1045 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1046 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1047 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1048 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1049 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1050 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1051 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1052 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1053 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1054 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1055 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1056 | case 0x10ec0260: |
| 1057 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1058 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1059 | snd_hda_codec_write(codec, 0x10, 0, |
| 1060 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1061 | break; |
| 1062 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1063 | case 0x10ec0267: |
| 1064 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1065 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1066 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1067 | case 0x10ec0660: |
| 1068 | case 0x10ec0662: |
| 1069 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1070 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1071 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1072 | snd_hda_codec_write(codec, 0x14, 0, |
| 1073 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1074 | snd_hda_codec_write(codec, 0x15, 0, |
| 1075 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1076 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1077 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1078 | switch (codec->vendor_id) { |
| 1079 | case 0x10ec0260: |
| 1080 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1081 | AC_VERB_SET_COEF_INDEX, 7); |
| 1082 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1083 | AC_VERB_GET_PROC_COEF, 0); |
| 1084 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1085 | AC_VERB_SET_COEF_INDEX, 7); |
| 1086 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1087 | AC_VERB_SET_PROC_COEF, |
| 1088 | tmp | 0x2010); |
| 1089 | break; |
| 1090 | case 0x10ec0262: |
| 1091 | case 0x10ec0880: |
| 1092 | case 0x10ec0882: |
| 1093 | case 0x10ec0883: |
| 1094 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1095 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1096 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1097 | snd_hda_codec_write(codec, 0x20, 0, |
| 1098 | AC_VERB_SET_COEF_INDEX, 7); |
| 1099 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1100 | AC_VERB_GET_PROC_COEF, 0); |
| 1101 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1102 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1103 | snd_hda_codec_write(codec, 0x20, 0, |
| 1104 | AC_VERB_SET_PROC_COEF, |
| 1105 | tmp | 0x2010); |
| 1106 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1107 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1108 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1109 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1110 | case 0x10ec0267: |
| 1111 | case 0x10ec0268: |
| 1112 | snd_hda_codec_write(codec, 0x20, 0, |
| 1113 | AC_VERB_SET_COEF_INDEX, 7); |
| 1114 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1115 | AC_VERB_GET_PROC_COEF, 0); |
| 1116 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1117 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1118 | snd_hda_codec_write(codec, 0x20, 0, |
| 1119 | AC_VERB_SET_PROC_COEF, |
| 1120 | tmp | 0x3000); |
| 1121 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1122 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1123 | break; |
| 1124 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1125 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1126 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1127 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1128 | { |
| 1129 | struct alc_spec *spec = codec->spec; |
| 1130 | |
| 1131 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1132 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1133 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1134 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1135 | if (spec->autocfg.line_out_pins[0] && |
| 1136 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1137 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1138 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1139 | else |
| 1140 | return; |
| 1141 | } |
| 1142 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1143 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1144 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1145 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1146 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1147 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1148 | spec->unsol_event = alc_sku_unsol_event; |
| 1149 | } |
| 1150 | |
| 1151 | /* check subsystem ID and set up device-specific initialization; |
| 1152 | * return 1 if initialized, 0 if invalid SSID |
| 1153 | */ |
| 1154 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1155 | * 31 ~ 16 : Manufacture ID |
| 1156 | * 15 ~ 8 : SKU ID |
| 1157 | * 7 ~ 0 : Assembly ID |
| 1158 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1159 | */ |
| 1160 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1161 | hda_nid_t porta, hda_nid_t porte, |
| 1162 | hda_nid_t portd) |
| 1163 | { |
| 1164 | unsigned int ass, tmp, i; |
| 1165 | unsigned nid; |
| 1166 | struct alc_spec *spec = codec->spec; |
| 1167 | |
| 1168 | ass = codec->subsystem_id & 0xffff; |
| 1169 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1170 | goto do_sku; |
| 1171 | |
| 1172 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1173 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1174 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1175 | * 29~21 : reserve |
| 1176 | * 20 : PCBEEP input |
| 1177 | * 19~16 : Check sum (15:1) |
| 1178 | * 15~1 : Custom |
| 1179 | * 0 : override |
| 1180 | */ |
| 1181 | nid = 0x1d; |
| 1182 | if (codec->vendor_id == 0x10ec0260) |
| 1183 | nid = 0x17; |
| 1184 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1185 | snd_printd("realtek: No valid SSID, " |
| 1186 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1187 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1188 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1189 | return 0; |
| 1190 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1191 | return 0; |
| 1192 | |
| 1193 | /* check sum */ |
| 1194 | tmp = 0; |
| 1195 | for (i = 1; i < 16; i++) { |
| 1196 | if ((ass >> i) & 1) |
| 1197 | tmp++; |
| 1198 | } |
| 1199 | if (((ass >> 16) & 0xf) != tmp) |
| 1200 | return 0; |
| 1201 | do_sku: |
| 1202 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1203 | ass & 0xffff, codec->vendor_id); |
| 1204 | /* |
| 1205 | * 0 : override |
| 1206 | * 1 : Swap Jack |
| 1207 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1208 | * 3~5 : External Amplifier control |
| 1209 | * 7~6 : Reserved |
| 1210 | */ |
| 1211 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1212 | switch (tmp) { |
| 1213 | case 1: |
| 1214 | spec->init_amp = ALC_INIT_GPIO1; |
| 1215 | break; |
| 1216 | case 3: |
| 1217 | spec->init_amp = ALC_INIT_GPIO2; |
| 1218 | break; |
| 1219 | case 7: |
| 1220 | spec->init_amp = ALC_INIT_GPIO3; |
| 1221 | break; |
| 1222 | case 5: |
| 1223 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1224 | break; |
| 1225 | } |
| 1226 | |
| 1227 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1228 | * when the external headphone out jack is plugged" |
| 1229 | */ |
| 1230 | if (!(ass & 0x8000)) |
| 1231 | return 1; |
| 1232 | /* |
| 1233 | * 10~8 : Jack location |
| 1234 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1235 | * 14~13: Resvered |
| 1236 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1237 | * when the external headphone out jack is plugged" |
| 1238 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1239 | if (!spec->autocfg.hp_pins[0]) { |
| 1240 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1241 | if (tmp == 0) |
| 1242 | spec->autocfg.hp_pins[0] = porta; |
| 1243 | else if (tmp == 1) |
| 1244 | spec->autocfg.hp_pins[0] = porte; |
| 1245 | else if (tmp == 2) |
| 1246 | spec->autocfg.hp_pins[0] = portd; |
| 1247 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1248 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1249 | } |
| 1250 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1251 | alc_init_auto_hp(codec); |
| 1252 | return 1; |
| 1253 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1254 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1255 | static void alc_ssid_check(struct hda_codec *codec, |
| 1256 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1257 | { |
| 1258 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1259 | struct alc_spec *spec = codec->spec; |
| 1260 | snd_printd("realtek: " |
| 1261 | "Enable default setup for auto mode as fallback\n"); |
| 1262 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1263 | alc_init_auto_hp(codec); |
| 1264 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1265 | } |
| 1266 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1267 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1268 | * Fix-up pin default configurations |
| 1269 | */ |
| 1270 | |
| 1271 | struct alc_pincfg { |
| 1272 | hda_nid_t nid; |
| 1273 | u32 val; |
| 1274 | }; |
| 1275 | |
| 1276 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1277 | const struct snd_pci_quirk *quirk, |
| 1278 | const struct alc_pincfg **pinfix) |
| 1279 | { |
| 1280 | const struct alc_pincfg *cfg; |
| 1281 | |
| 1282 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1283 | if (!quirk) |
| 1284 | return; |
| 1285 | |
| 1286 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1287 | for (; cfg->nid; cfg++) |
| 1288 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1289 | } |
| 1290 | |
| 1291 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1292 | * ALC888 |
| 1293 | */ |
| 1294 | |
| 1295 | /* |
| 1296 | * 2ch mode |
| 1297 | */ |
| 1298 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1299 | /* Mic-in jack as mic in */ |
| 1300 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1301 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1302 | /* Line-in jack as Line in */ |
| 1303 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1304 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1305 | /* Line-Out as Front */ |
| 1306 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1307 | { } /* end */ |
| 1308 | }; |
| 1309 | |
| 1310 | /* |
| 1311 | * 4ch mode |
| 1312 | */ |
| 1313 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1314 | /* Mic-in jack as mic in */ |
| 1315 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1316 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1317 | /* Line-in jack as Surround */ |
| 1318 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1319 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1320 | /* Line-Out as Front */ |
| 1321 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1322 | { } /* end */ |
| 1323 | }; |
| 1324 | |
| 1325 | /* |
| 1326 | * 6ch mode |
| 1327 | */ |
| 1328 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1329 | /* Mic-in jack as CLFE */ |
| 1330 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1331 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1332 | /* Line-in jack as Surround */ |
| 1333 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1334 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1335 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1336 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1337 | { } /* end */ |
| 1338 | }; |
| 1339 | |
| 1340 | /* |
| 1341 | * 8ch mode |
| 1342 | */ |
| 1343 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1344 | /* Mic-in jack as CLFE */ |
| 1345 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1346 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1347 | /* Line-in jack as Surround */ |
| 1348 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1349 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1350 | /* Line-Out as Side */ |
| 1351 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1352 | { } /* end */ |
| 1353 | }; |
| 1354 | |
| 1355 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1356 | { 2, alc888_4ST_ch2_intel_init }, |
| 1357 | { 4, alc888_4ST_ch4_intel_init }, |
| 1358 | { 6, alc888_4ST_ch6_intel_init }, |
| 1359 | { 8, alc888_4ST_ch8_intel_init }, |
| 1360 | }; |
| 1361 | |
| 1362 | /* |
| 1363 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1364 | */ |
| 1365 | |
| 1366 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1367 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1368 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1369 | /* Connect Internal HP to Front */ |
| 1370 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1371 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1372 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1373 | /* Connect Bass HP to Front */ |
| 1374 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1375 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1376 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1377 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1378 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1379 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1380 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1381 | /* Connect Mic jack to CLFE */ |
| 1382 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1383 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1384 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1385 | /* Connect Line-in jack to Surround */ |
| 1386 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1387 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1388 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1389 | /* Connect HP out jack to Front */ |
| 1390 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1391 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1392 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1393 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1394 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1395 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1396 | {} |
| 1397 | }; |
| 1398 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1399 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1400 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1401 | struct alc_spec *spec = codec->spec; |
| 1402 | unsigned int val, mute; |
| 1403 | hda_nid_t nid; |
| 1404 | int i; |
| 1405 | |
| 1406 | spec->jack_present = 0; |
| 1407 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1408 | nid = spec->autocfg.hp_pins[i]; |
| 1409 | if (!nid) |
| 1410 | break; |
| 1411 | val = snd_hda_codec_read(codec, nid, 0, |
| 1412 | AC_VERB_GET_PIN_SENSE, 0); |
| 1413 | if (val & AC_PINSENSE_PRESENCE) { |
| 1414 | spec->jack_present = 1; |
| 1415 | break; |
| 1416 | } |
| 1417 | } |
| 1418 | |
| 1419 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1420 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1421 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1422 | nid = spec->autocfg.speaker_pins[i]; |
| 1423 | if (!nid) |
| 1424 | break; |
| 1425 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1426 | HDA_AMP_MUTE, mute); |
| 1427 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1428 | } |
| 1429 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1430 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1431 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1432 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1433 | if (codec->vendor_id == 0x10ec0880) |
| 1434 | res >>= 28; |
| 1435 | else |
| 1436 | res >>= 26; |
| 1437 | if (res == ALC880_HP_EVENT) |
| 1438 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1439 | } |
| 1440 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1441 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1442 | { |
| 1443 | struct alc_spec *spec = codec->spec; |
| 1444 | |
| 1445 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1446 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1447 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1448 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1449 | alc_automute_amp(codec); |
| 1450 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1451 | |
| 1452 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1453 | * ALC888 Acer Aspire 4930G model |
| 1454 | */ |
| 1455 | |
| 1456 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1457 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1458 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1459 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1460 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1461 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1462 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1463 | /* Connect Internal HP to front */ |
| 1464 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1465 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1466 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1467 | /* Connect HP out to front */ |
| 1468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1470 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1471 | { } |
| 1472 | }; |
| 1473 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1474 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1475 | * ALC888 Acer Aspire 6530G model |
| 1476 | */ |
| 1477 | |
| 1478 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1479 | /* Bias voltage on for external mic port */ |
| 1480 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 1481 | /* Enable unsolicited event for HP jack */ |
| 1482 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1483 | /* Enable speaker output */ |
| 1484 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1485 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1486 | /* Enable headphone output */ |
| 1487 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1488 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1489 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1490 | { } |
| 1491 | }; |
| 1492 | |
| 1493 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1494 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1495 | */ |
| 1496 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1497 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1498 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1499 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1500 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1501 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1502 | /* Enable unsolicited event for HP jack */ |
| 1503 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1504 | /* Connect Internal Front to Front */ |
| 1505 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1507 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1508 | /* Connect Internal Rear to Rear */ |
| 1509 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1510 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1511 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1512 | /* Connect Internal CLFE to CLFE */ |
| 1513 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1514 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1515 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1516 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1517 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1519 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1520 | /* Enable all DACs */ |
| 1521 | /* DAC DISABLE/MUTE 1? */ |
| 1522 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1523 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1524 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1525 | /* DAC DISABLE/MUTE 2? */ |
| 1526 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1527 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1528 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1529 | /* Enable amplifiers */ |
| 1530 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1531 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1532 | /* DMIC fix |
| 1533 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1534 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1535 | * makes the signal become a difference/sum signal instead of standard |
| 1536 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1537 | * codec replicate the sum signal to both channels, turning it into a |
| 1538 | * normal mono mic. |
| 1539 | */ |
| 1540 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1541 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1542 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1543 | { } |
| 1544 | }; |
| 1545 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1546 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1547 | /* Front mic only available on one ADC */ |
| 1548 | { |
| 1549 | .num_items = 4, |
| 1550 | .items = { |
| 1551 | { "Mic", 0x0 }, |
| 1552 | { "Line", 0x2 }, |
| 1553 | { "CD", 0x4 }, |
| 1554 | { "Front Mic", 0xb }, |
| 1555 | }, |
| 1556 | }, |
| 1557 | { |
| 1558 | .num_items = 3, |
| 1559 | .items = { |
| 1560 | { "Mic", 0x0 }, |
| 1561 | { "Line", 0x2 }, |
| 1562 | { "CD", 0x4 }, |
| 1563 | }, |
| 1564 | } |
| 1565 | }; |
| 1566 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1567 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1568 | /* Interal mic only available on one ADC */ |
| 1569 | { |
| 1570 | .num_items = 3, |
| 1571 | .items = { |
| 1572 | { "Ext Mic", 0x0 }, |
| 1573 | { "CD", 0x4 }, |
| 1574 | { "Int Mic", 0xb }, |
| 1575 | }, |
| 1576 | }, |
| 1577 | { |
| 1578 | .num_items = 2, |
| 1579 | .items = { |
| 1580 | { "Ext Mic", 0x0 }, |
| 1581 | { "CD", 0x4 }, |
| 1582 | }, |
| 1583 | } |
| 1584 | }; |
| 1585 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1586 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1587 | /* Digital mic only available on first "ADC" */ |
| 1588 | { |
| 1589 | .num_items = 5, |
| 1590 | .items = { |
| 1591 | { "Mic", 0x0 }, |
| 1592 | { "Line", 0x2 }, |
| 1593 | { "CD", 0x4 }, |
| 1594 | { "Front Mic", 0xb }, |
| 1595 | { "Input Mix", 0xa }, |
| 1596 | }, |
| 1597 | }, |
| 1598 | { |
| 1599 | .num_items = 4, |
| 1600 | .items = { |
| 1601 | { "Mic", 0x0 }, |
| 1602 | { "Line", 0x2 }, |
| 1603 | { "CD", 0x4 }, |
| 1604 | { "Input Mix", 0xa }, |
| 1605 | }, |
| 1606 | }, |
| 1607 | { |
| 1608 | .num_items = 4, |
| 1609 | .items = { |
| 1610 | { "Mic", 0x0 }, |
| 1611 | { "Line", 0x2 }, |
| 1612 | { "CD", 0x4 }, |
| 1613 | { "Input Mix", 0xa }, |
| 1614 | }, |
| 1615 | } |
| 1616 | }; |
| 1617 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1618 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1619 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1620 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1621 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1622 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1623 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1624 | HDA_OUTPUT), |
| 1625 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1626 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1627 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1628 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1629 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1630 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1631 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1632 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1633 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1635 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1636 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1637 | { } /* end */ |
| 1638 | }; |
| 1639 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1640 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1641 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1642 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1643 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1644 | spec->autocfg.hp_pins[0] = 0x15; |
| 1645 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1646 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1647 | } |
| 1648 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1649 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1650 | { |
| 1651 | struct alc_spec *spec = codec->spec; |
| 1652 | |
| 1653 | spec->autocfg.hp_pins[0] = 0x15; |
| 1654 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1655 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1656 | spec->autocfg.speaker_pins[2] = 0x1b; |
| 1657 | alc_automute_amp(codec); |
| 1658 | } |
| 1659 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1660 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1661 | * ALC880 3-stack model |
| 1662 | * |
| 1663 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1664 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1665 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1666 | */ |
| 1667 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1668 | static hda_nid_t alc880_dac_nids[4] = { |
| 1669 | /* front, rear, clfe, rear_surr */ |
| 1670 | 0x02, 0x05, 0x04, 0x03 |
| 1671 | }; |
| 1672 | |
| 1673 | static hda_nid_t alc880_adc_nids[3] = { |
| 1674 | /* ADC0-2 */ |
| 1675 | 0x07, 0x08, 0x09, |
| 1676 | }; |
| 1677 | |
| 1678 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1679 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1680 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1681 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1682 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1683 | /* ADC1-2 */ |
| 1684 | 0x08, 0x09, |
| 1685 | }; |
| 1686 | |
| 1687 | #define ALC880_DIGOUT_NID 0x06 |
| 1688 | #define ALC880_DIGIN_NID 0x0a |
| 1689 | |
| 1690 | static struct hda_input_mux alc880_capture_source = { |
| 1691 | .num_items = 4, |
| 1692 | .items = { |
| 1693 | { "Mic", 0x0 }, |
| 1694 | { "Front Mic", 0x3 }, |
| 1695 | { "Line", 0x2 }, |
| 1696 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1697 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1698 | }; |
| 1699 | |
| 1700 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1701 | /* 2ch mode */ |
| 1702 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1703 | /* set line-in to input, mute it */ |
| 1704 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1705 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1706 | /* set mic-in to input vref 80%, mute it */ |
| 1707 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1708 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1709 | { } /* end */ |
| 1710 | }; |
| 1711 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1712 | /* 6ch mode */ |
| 1713 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1714 | /* set line-in to output, unmute it */ |
| 1715 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1716 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1717 | /* set mic-in to output, unmute it */ |
| 1718 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1719 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1720 | { } /* end */ |
| 1721 | }; |
| 1722 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1723 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1724 | { 2, alc880_threestack_ch2_init }, |
| 1725 | { 6, alc880_threestack_ch6_init }, |
| 1726 | }; |
| 1727 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1728 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1729 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1730 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1731 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1732 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1733 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1734 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1735 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1736 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1737 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1738 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1739 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1740 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1741 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1742 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1743 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1744 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1745 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1746 | { |
| 1747 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1748 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1749 | .info = alc_ch_mode_info, |
| 1750 | .get = alc_ch_mode_get, |
| 1751 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1752 | }, |
| 1753 | { } /* end */ |
| 1754 | }; |
| 1755 | |
| 1756 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1757 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1758 | struct snd_ctl_elem_info *uinfo) |
| 1759 | { |
| 1760 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1761 | struct alc_spec *spec = codec->spec; |
| 1762 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1763 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1764 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1765 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1766 | HDA_INPUT); |
| 1767 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1768 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1769 | return err; |
| 1770 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1771 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1772 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1773 | unsigned int size, unsigned int __user *tlv) |
| 1774 | { |
| 1775 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1776 | struct alc_spec *spec = codec->spec; |
| 1777 | int err; |
| 1778 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1779 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1780 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1781 | HDA_INPUT); |
| 1782 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1783 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1784 | return err; |
| 1785 | } |
| 1786 | |
| 1787 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1788 | struct snd_ctl_elem_value *ucontrol); |
| 1789 | |
| 1790 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1791 | struct snd_ctl_elem_value *ucontrol, |
| 1792 | getput_call_t func) |
| 1793 | { |
| 1794 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1795 | struct alc_spec *spec = codec->spec; |
| 1796 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1797 | int err; |
| 1798 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1799 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1800 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1801 | 3, 0, HDA_INPUT); |
| 1802 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1803 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1804 | return err; |
| 1805 | } |
| 1806 | |
| 1807 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1808 | struct snd_ctl_elem_value *ucontrol) |
| 1809 | { |
| 1810 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1811 | snd_hda_mixer_amp_volume_get); |
| 1812 | } |
| 1813 | |
| 1814 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1815 | struct snd_ctl_elem_value *ucontrol) |
| 1816 | { |
| 1817 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1818 | snd_hda_mixer_amp_volume_put); |
| 1819 | } |
| 1820 | |
| 1821 | /* capture mixer elements */ |
| 1822 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1823 | |
| 1824 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1825 | struct snd_ctl_elem_value *ucontrol) |
| 1826 | { |
| 1827 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1828 | snd_hda_mixer_amp_switch_get); |
| 1829 | } |
| 1830 | |
| 1831 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1832 | struct snd_ctl_elem_value *ucontrol) |
| 1833 | { |
| 1834 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1835 | snd_hda_mixer_amp_switch_put); |
| 1836 | } |
| 1837 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1838 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1839 | { \ |
| 1840 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1841 | .name = "Capture Switch", \ |
| 1842 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1843 | .count = num, \ |
| 1844 | .info = alc_cap_sw_info, \ |
| 1845 | .get = alc_cap_sw_get, \ |
| 1846 | .put = alc_cap_sw_put, \ |
| 1847 | }, \ |
| 1848 | { \ |
| 1849 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1850 | .name = "Capture Volume", \ |
| 1851 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1852 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1853 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1854 | .count = num, \ |
| 1855 | .info = alc_cap_vol_info, \ |
| 1856 | .get = alc_cap_vol_get, \ |
| 1857 | .put = alc_cap_vol_put, \ |
| 1858 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1859 | } |
| 1860 | |
| 1861 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1862 | { \ |
| 1863 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1864 | /* .name = "Capture Source", */ \ |
| 1865 | .name = "Input Source", \ |
| 1866 | .count = num, \ |
| 1867 | .info = alc_mux_enum_info, \ |
| 1868 | .get = alc_mux_enum_get, \ |
| 1869 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1870 | } |
| 1871 | |
| 1872 | #define DEFINE_CAPMIX(num) \ |
| 1873 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1874 | _DEFINE_CAPMIX(num), \ |
| 1875 | _DEFINE_CAPSRC(num), \ |
| 1876 | { } /* end */ \ |
| 1877 | } |
| 1878 | |
| 1879 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1880 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1881 | _DEFINE_CAPMIX(num), \ |
| 1882 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1883 | } |
| 1884 | |
| 1885 | /* up to three ADCs */ |
| 1886 | DEFINE_CAPMIX(1); |
| 1887 | DEFINE_CAPMIX(2); |
| 1888 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1889 | DEFINE_CAPMIX_NOSRC(1); |
| 1890 | DEFINE_CAPMIX_NOSRC(2); |
| 1891 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1892 | |
| 1893 | /* |
| 1894 | * ALC880 5-stack model |
| 1895 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1896 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1897 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1898 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1899 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1900 | */ |
| 1901 | |
| 1902 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1903 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1904 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1905 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1906 | { } /* end */ |
| 1907 | }; |
| 1908 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1909 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1910 | /* 6ch mode */ |
| 1911 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1912 | /* set line-in to input, mute it */ |
| 1913 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1914 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1915 | { } /* end */ |
| 1916 | }; |
| 1917 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1918 | /* 8ch mode */ |
| 1919 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1920 | /* set line-in to output, unmute it */ |
| 1921 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1922 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1923 | { } /* end */ |
| 1924 | }; |
| 1925 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1926 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1927 | { 6, alc880_fivestack_ch6_init }, |
| 1928 | { 8, alc880_fivestack_ch8_init }, |
| 1929 | }; |
| 1930 | |
| 1931 | |
| 1932 | /* |
| 1933 | * ALC880 6-stack model |
| 1934 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1935 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1936 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1937 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1938 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1939 | */ |
| 1940 | |
| 1941 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1942 | /* front, rear, clfe, rear_surr */ |
| 1943 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1944 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1945 | |
| 1946 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1947 | .num_items = 4, |
| 1948 | .items = { |
| 1949 | { "Mic", 0x0 }, |
| 1950 | { "Front Mic", 0x1 }, |
| 1951 | { "Line", 0x2 }, |
| 1952 | { "CD", 0x4 }, |
| 1953 | }, |
| 1954 | }; |
| 1955 | |
| 1956 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1957 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1958 | { 8, NULL }, |
| 1959 | }; |
| 1960 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1961 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1962 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1963 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1964 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1965 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1966 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1967 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1968 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1969 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1970 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1971 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1979 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1980 | { |
| 1981 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1982 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1983 | .info = alc_ch_mode_info, |
| 1984 | .get = alc_ch_mode_get, |
| 1985 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1986 | }, |
| 1987 | { } /* end */ |
| 1988 | }; |
| 1989 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1990 | |
| 1991 | /* |
| 1992 | * ALC880 W810 model |
| 1993 | * |
| 1994 | * W810 has rear IO for: |
| 1995 | * Front (DAC 02) |
| 1996 | * Surround (DAC 03) |
| 1997 | * Center/LFE (DAC 04) |
| 1998 | * Digital out (06) |
| 1999 | * |
| 2000 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2001 | * 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] | 2002 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2003 | * There is a variable resistor to control the speaker or headphone |
| 2004 | * volume. This is a hardware-only device without a software API. |
| 2005 | * |
| 2006 | * Plugging headphones in will disable the internal speakers. This is |
| 2007 | * implemented in hardware, not via the driver using jack sense. In |
| 2008 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2009 | * disable both the speakers and headphones. |
| 2010 | * |
| 2011 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2012 | * These may not do anything useful with this driver yet, because I |
| 2013 | * haven't setup any initialization verbs for these yet... |
| 2014 | */ |
| 2015 | |
| 2016 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2017 | /* front, rear/surround, clfe */ |
| 2018 | 0x02, 0x03, 0x04 |
| 2019 | }; |
| 2020 | |
| 2021 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2022 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2023 | { 6, NULL } |
| 2024 | }; |
| 2025 | |
| 2026 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2027 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2028 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2029 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2030 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2031 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2032 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2033 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2034 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2035 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2036 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2037 | { } /* end */ |
| 2038 | }; |
| 2039 | |
| 2040 | |
| 2041 | /* |
| 2042 | * Z710V model |
| 2043 | * |
| 2044 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2045 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2046 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2047 | */ |
| 2048 | |
| 2049 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2050 | 0x02 |
| 2051 | }; |
| 2052 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2053 | |
| 2054 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2055 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2056 | { 2, NULL } |
| 2057 | }; |
| 2058 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2059 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2061 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2062 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2063 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2064 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2065 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2066 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2067 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2068 | { } /* end */ |
| 2069 | }; |
| 2070 | |
| 2071 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2072 | /* |
| 2073 | * ALC880 F1734 model |
| 2074 | * |
| 2075 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2076 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2077 | */ |
| 2078 | |
| 2079 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2080 | 0x03 |
| 2081 | }; |
| 2082 | #define ALC880_F1734_HP_DAC 0x02 |
| 2083 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2084 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2085 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2086 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2087 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2088 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2089 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2090 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2091 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2092 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2093 | { } /* end */ |
| 2094 | }; |
| 2095 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2096 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2097 | .num_items = 2, |
| 2098 | .items = { |
| 2099 | { "Mic", 0x1 }, |
| 2100 | { "CD", 0x4 }, |
| 2101 | }, |
| 2102 | }; |
| 2103 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2104 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2105 | /* |
| 2106 | * ALC880 ASUS model |
| 2107 | * |
| 2108 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2109 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2110 | * Mic = 0x18, Line = 0x1a |
| 2111 | */ |
| 2112 | |
| 2113 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2114 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2115 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2116 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2117 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2118 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2119 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2120 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2121 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2122 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2123 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2124 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2131 | { |
| 2132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2133 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2134 | .info = alc_ch_mode_info, |
| 2135 | .get = alc_ch_mode_get, |
| 2136 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2137 | }, |
| 2138 | { } /* end */ |
| 2139 | }; |
| 2140 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2141 | /* |
| 2142 | * ALC880 ASUS W1V model |
| 2143 | * |
| 2144 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2145 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2146 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2147 | */ |
| 2148 | |
| 2149 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2150 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2151 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2152 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2153 | { } /* end */ |
| 2154 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2155 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2156 | /* TCL S700 */ |
| 2157 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2158 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2159 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2160 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2161 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2162 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2163 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2164 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2165 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2166 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2167 | { } /* end */ |
| 2168 | }; |
| 2169 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2170 | /* Uniwill */ |
| 2171 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2172 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2173 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2174 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2175 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2176 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2177 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2178 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2179 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2180 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2181 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2182 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2183 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2184 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2185 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2186 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2187 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2188 | { |
| 2189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2190 | .name = "Channel Mode", |
| 2191 | .info = alc_ch_mode_info, |
| 2192 | .get = alc_ch_mode_get, |
| 2193 | .put = alc_ch_mode_put, |
| 2194 | }, |
| 2195 | { } /* end */ |
| 2196 | }; |
| 2197 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2198 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2199 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2200 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2201 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2202 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2203 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2204 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2205 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2206 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2207 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2208 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2209 | { } /* end */ |
| 2210 | }; |
| 2211 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2212 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2213 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2214 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2215 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2216 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2217 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2219 | { } /* end */ |
| 2220 | }; |
| 2221 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2222 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2223 | * virtual master controls |
| 2224 | */ |
| 2225 | |
| 2226 | /* |
| 2227 | * slave controls for virtual master |
| 2228 | */ |
| 2229 | static const char *alc_slave_vols[] = { |
| 2230 | "Front Playback Volume", |
| 2231 | "Surround Playback Volume", |
| 2232 | "Center Playback Volume", |
| 2233 | "LFE Playback Volume", |
| 2234 | "Side Playback Volume", |
| 2235 | "Headphone Playback Volume", |
| 2236 | "Speaker Playback Volume", |
| 2237 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2238 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2239 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2240 | NULL, |
| 2241 | }; |
| 2242 | |
| 2243 | static const char *alc_slave_sws[] = { |
| 2244 | "Front Playback Switch", |
| 2245 | "Surround Playback Switch", |
| 2246 | "Center Playback Switch", |
| 2247 | "LFE Playback Switch", |
| 2248 | "Side Playback Switch", |
| 2249 | "Headphone Playback Switch", |
| 2250 | "Speaker Playback Switch", |
| 2251 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2252 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2253 | NULL, |
| 2254 | }; |
| 2255 | |
| 2256 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2257 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2258 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2259 | |
| 2260 | static void alc_free_kctls(struct hda_codec *codec); |
| 2261 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2262 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2263 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2264 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2265 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2266 | { } /* end */ |
| 2267 | }; |
| 2268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2269 | static int alc_build_controls(struct hda_codec *codec) |
| 2270 | { |
| 2271 | struct alc_spec *spec = codec->spec; |
| 2272 | int err; |
| 2273 | int i; |
| 2274 | |
| 2275 | for (i = 0; i < spec->num_mixers; i++) { |
| 2276 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2277 | if (err < 0) |
| 2278 | return err; |
| 2279 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2280 | if (spec->cap_mixer) { |
| 2281 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2282 | if (err < 0) |
| 2283 | return err; |
| 2284 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2285 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2286 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2287 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2288 | if (err < 0) |
| 2289 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2290 | if (!spec->no_analog) { |
| 2291 | err = snd_hda_create_spdif_share_sw(codec, |
| 2292 | &spec->multiout); |
| 2293 | if (err < 0) |
| 2294 | return err; |
| 2295 | spec->multiout.share_spdif = 1; |
| 2296 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2297 | } |
| 2298 | if (spec->dig_in_nid) { |
| 2299 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2300 | if (err < 0) |
| 2301 | return err; |
| 2302 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2303 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2304 | /* create beep controls if needed */ |
| 2305 | if (spec->beep_amp) { |
| 2306 | struct snd_kcontrol_new *knew; |
| 2307 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2308 | struct snd_kcontrol *kctl; |
| 2309 | kctl = snd_ctl_new1(knew, codec); |
| 2310 | if (!kctl) |
| 2311 | return -ENOMEM; |
| 2312 | kctl->private_value = spec->beep_amp; |
| 2313 | err = snd_hda_ctl_add(codec, kctl); |
| 2314 | if (err < 0) |
| 2315 | return err; |
| 2316 | } |
| 2317 | } |
| 2318 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2319 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2320 | if (!spec->no_analog && |
| 2321 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2322 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2323 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2324 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2325 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2326 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2327 | if (err < 0) |
| 2328 | return err; |
| 2329 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2330 | if (!spec->no_analog && |
| 2331 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2332 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2333 | NULL, alc_slave_sws); |
| 2334 | if (err < 0) |
| 2335 | return err; |
| 2336 | } |
| 2337 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2338 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2339 | return 0; |
| 2340 | } |
| 2341 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2342 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2343 | /* |
| 2344 | * initialize the codec volumes, etc |
| 2345 | */ |
| 2346 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2347 | /* |
| 2348 | * generic initialization of ADC, input mixers and output mixers |
| 2349 | */ |
| 2350 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2351 | /* |
| 2352 | * Unmute ADC0-2 and set the default input to mic-in |
| 2353 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2354 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2355 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2356 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2357 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2358 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2359 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2360 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2361 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2362 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2363 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2364 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2365 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2366 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2367 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2368 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2373 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2374 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2375 | /* |
| 2376 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2377 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2378 | /* set vol=0 to output mixers */ |
| 2379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2380 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2381 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2382 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2383 | /* set up input amps for analog loopback */ |
| 2384 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2385 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2387 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2388 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2389 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2390 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2391 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2392 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2393 | |
| 2394 | { } |
| 2395 | }; |
| 2396 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2397 | /* |
| 2398 | * 3-stack pin configuration: |
| 2399 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2400 | */ |
| 2401 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2402 | /* |
| 2403 | * preset connection lists of input pins |
| 2404 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2405 | */ |
| 2406 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2407 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2408 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2409 | |
| 2410 | /* |
| 2411 | * Set pin mode and muting |
| 2412 | */ |
| 2413 | /* set front pin widgets 0x14 for output */ |
| 2414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2415 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2416 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2417 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2418 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2419 | /* Mic2 (as headphone out) for HP output */ |
| 2420 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2421 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2422 | /* Line In pin widget for input */ |
| 2423 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2424 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2425 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2426 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2427 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2428 | /* CD pin widget for input */ |
| 2429 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2430 | |
| 2431 | { } |
| 2432 | }; |
| 2433 | |
| 2434 | /* |
| 2435 | * 5-stack pin configuration: |
| 2436 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2437 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2438 | */ |
| 2439 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2440 | /* |
| 2441 | * preset connection lists of input pins |
| 2442 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2443 | */ |
| 2444 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2445 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2446 | |
| 2447 | /* |
| 2448 | * Set pin mode and muting |
| 2449 | */ |
| 2450 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2451 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2452 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2453 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2454 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2455 | /* unmute pins for output (no gain on this amp) */ |
| 2456 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2457 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2458 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2459 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2460 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2461 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2462 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2463 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2464 | /* Mic2 (as headphone out) for HP output */ |
| 2465 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2466 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2467 | /* Line In pin widget for input */ |
| 2468 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2469 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2470 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2471 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2472 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2473 | /* CD pin widget for input */ |
| 2474 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2475 | |
| 2476 | { } |
| 2477 | }; |
| 2478 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2479 | /* |
| 2480 | * W810 pin configuration: |
| 2481 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2482 | */ |
| 2483 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2484 | /* hphone/speaker input selector: front DAC */ |
| 2485 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2486 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2487 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2488 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2489 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2490 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2491 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2492 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2493 | |
| 2494 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2495 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2496 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | { } |
| 2498 | }; |
| 2499 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2500 | /* |
| 2501 | * Z71V pin configuration: |
| 2502 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2503 | */ |
| 2504 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2505 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2507 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2508 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2509 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2510 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2511 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2512 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2513 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2514 | |
| 2515 | { } |
| 2516 | }; |
| 2517 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2518 | /* |
| 2519 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2520 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2521 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2522 | */ |
| 2523 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2524 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2525 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2528 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2529 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2530 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2531 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2532 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2533 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2534 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2535 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2536 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2537 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2538 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2539 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2540 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2541 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2542 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2543 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2544 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2545 | { } |
| 2546 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2547 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2548 | /* |
| 2549 | * Uniwill pin configuration: |
| 2550 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2551 | * line = 0x1a |
| 2552 | */ |
| 2553 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2554 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2555 | |
| 2556 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2557 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2558 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2559 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2560 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2561 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2562 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2563 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2564 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2565 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2566 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2567 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2568 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2569 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2570 | |
| 2571 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2572 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2573 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2574 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2575 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2576 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2577 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2578 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2579 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2580 | |
| 2581 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2582 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2583 | |
| 2584 | { } |
| 2585 | }; |
| 2586 | |
| 2587 | /* |
| 2588 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2589 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2590 | */ |
| 2591 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2592 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2593 | |
| 2594 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2595 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2596 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2597 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2598 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2599 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2600 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2602 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2603 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2604 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2605 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2606 | |
| 2607 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2608 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2609 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2610 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2611 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2612 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2613 | |
| 2614 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2615 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2616 | |
| 2617 | { } |
| 2618 | }; |
| 2619 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2620 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2621 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2622 | { } |
| 2623 | }; |
| 2624 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2625 | /* auto-toggle front mic */ |
| 2626 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2627 | { |
| 2628 | unsigned int present; |
| 2629 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2630 | |
| 2631 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2632 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2633 | bits = present ? HDA_AMP_MUTE : 0; |
| 2634 | 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] | 2635 | } |
| 2636 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2637 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2638 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2639 | struct alc_spec *spec = codec->spec; |
| 2640 | |
| 2641 | spec->autocfg.hp_pins[0] = 0x14; |
| 2642 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2643 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2644 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2645 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2646 | } |
| 2647 | |
| 2648 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2649 | unsigned int res) |
| 2650 | { |
| 2651 | /* Looks like the unsol event is incompatible with the standard |
| 2652 | * definition. 4bit tag is placed at 28 bit! |
| 2653 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2654 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2655 | case ALC880_MIC_EVENT: |
| 2656 | alc880_uniwill_mic_automute(codec); |
| 2657 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2658 | default: |
| 2659 | alc_automute_amp_unsol_event(codec, res); |
| 2660 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2661 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2662 | } |
| 2663 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2664 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2665 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2666 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2667 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2668 | spec->autocfg.hp_pins[0] = 0x14; |
| 2669 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2670 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2671 | } |
| 2672 | |
| 2673 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2674 | { |
| 2675 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2676 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2677 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2678 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2679 | present &= HDA_AMP_VOLMASK; |
| 2680 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2681 | HDA_AMP_VOLMASK, present); |
| 2682 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2683 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2684 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2685 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2686 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2687 | unsigned int res) |
| 2688 | { |
| 2689 | /* Looks like the unsol event is incompatible with the standard |
| 2690 | * definition. 4bit tag is placed at 28 bit! |
| 2691 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2692 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2693 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2694 | else |
| 2695 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2696 | } |
| 2697 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2698 | /* |
| 2699 | * F1734 pin configuration: |
| 2700 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2701 | */ |
| 2702 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2703 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2705 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2706 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2707 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2708 | |
| 2709 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2710 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2713 | |
| 2714 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2715 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2716 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2717 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2718 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2719 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2720 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2721 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2722 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2723 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2724 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2725 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2726 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2727 | { } |
| 2728 | }; |
| 2729 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2730 | /* |
| 2731 | * ASUS pin configuration: |
| 2732 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2733 | */ |
| 2734 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2735 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2736 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2737 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2738 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2739 | |
| 2740 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2741 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2742 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2743 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2744 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2746 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2747 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2748 | |
| 2749 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2750 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2751 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2752 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2753 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2754 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2755 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2756 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2757 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2758 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2759 | { } |
| 2760 | }; |
| 2761 | |
| 2762 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2763 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2764 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2765 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2766 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2767 | /* Clevo m520g init */ |
| 2768 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2769 | /* headphone output */ |
| 2770 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2771 | /* line-out */ |
| 2772 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2773 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2774 | /* Line-in */ |
| 2775 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2776 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2777 | /* CD */ |
| 2778 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2779 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2780 | /* Mic1 (rear panel) */ |
| 2781 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2782 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2783 | /* Mic2 (front panel) */ |
| 2784 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2785 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2786 | /* headphone */ |
| 2787 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2788 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2789 | /* change to EAPD mode */ |
| 2790 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2791 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2792 | |
| 2793 | { } |
| 2794 | }; |
| 2795 | |
| 2796 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2797 | /* change to EAPD mode */ |
| 2798 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2799 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2800 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2801 | /* Headphone output */ |
| 2802 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2803 | /* Front output*/ |
| 2804 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2805 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2806 | |
| 2807 | /* Line In pin widget for input */ |
| 2808 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2809 | /* CD pin widget for input */ |
| 2810 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2811 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2812 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2813 | |
| 2814 | /* change to EAPD mode */ |
| 2815 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2816 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2817 | |
| 2818 | { } |
| 2819 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2820 | |
| 2821 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2822 | * LG m1 express dual |
| 2823 | * |
| 2824 | * Pin assignment: |
| 2825 | * Rear Line-In/Out (blue): 0x14 |
| 2826 | * Build-in Mic-In: 0x15 |
| 2827 | * Speaker-out: 0x17 |
| 2828 | * HP-Out (green): 0x1b |
| 2829 | * Mic-In/Out (red): 0x19 |
| 2830 | * SPDIF-Out: 0x1e |
| 2831 | */ |
| 2832 | |
| 2833 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2834 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2835 | 0x05, 0x02, 0x03 |
| 2836 | }; |
| 2837 | |
| 2838 | /* seems analog CD is not working */ |
| 2839 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2840 | .num_items = 3, |
| 2841 | .items = { |
| 2842 | { "Mic", 0x1 }, |
| 2843 | { "Line", 0x5 }, |
| 2844 | { "Internal Mic", 0x6 }, |
| 2845 | }, |
| 2846 | }; |
| 2847 | |
| 2848 | /* 2,4,6 channel modes */ |
| 2849 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2850 | /* set line-in and mic-in to input */ |
| 2851 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2852 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2853 | { } |
| 2854 | }; |
| 2855 | |
| 2856 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2857 | /* set line-in to out and mic-in to input */ |
| 2858 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2859 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2860 | { } |
| 2861 | }; |
| 2862 | |
| 2863 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2864 | /* set line-in and mic-in to output */ |
| 2865 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2866 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2867 | { } |
| 2868 | }; |
| 2869 | |
| 2870 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2871 | { 2, alc880_lg_ch2_init }, |
| 2872 | { 4, alc880_lg_ch4_init }, |
| 2873 | { 6, alc880_lg_ch6_init }, |
| 2874 | }; |
| 2875 | |
| 2876 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2878 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2879 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2880 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2881 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2882 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2883 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2884 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2885 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2886 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2887 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2888 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2889 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2890 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2891 | { |
| 2892 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2893 | .name = "Channel Mode", |
| 2894 | .info = alc_ch_mode_info, |
| 2895 | .get = alc_ch_mode_get, |
| 2896 | .put = alc_ch_mode_put, |
| 2897 | }, |
| 2898 | { } /* end */ |
| 2899 | }; |
| 2900 | |
| 2901 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2902 | /* set capture source to mic-in */ |
| 2903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2904 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2905 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2906 | /* mute all amp mixer inputs */ |
| 2907 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2908 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2909 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2910 | /* line-in to input */ |
| 2911 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2912 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2913 | /* built-in mic */ |
| 2914 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2915 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2916 | /* speaker-out */ |
| 2917 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2918 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2919 | /* mic-in to input */ |
| 2920 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2921 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2922 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2923 | /* HP-out */ |
| 2924 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2925 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2926 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2927 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2928 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2929 | { } |
| 2930 | }; |
| 2931 | |
| 2932 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2933 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2934 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2935 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2936 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2937 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2938 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2939 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2940 | } |
| 2941 | |
| 2942 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2943 | * LG LW20 |
| 2944 | * |
| 2945 | * Pin assignment: |
| 2946 | * Speaker-out: 0x14 |
| 2947 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2948 | * Built-in Mic-In: 0x19 |
| 2949 | * Line-In: 0x1b |
| 2950 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2951 | * SPDIF-Out: 0x1e |
| 2952 | */ |
| 2953 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2954 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2955 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2956 | .items = { |
| 2957 | { "Mic", 0x0 }, |
| 2958 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2959 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2960 | }, |
| 2961 | }; |
| 2962 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2963 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2964 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2965 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2966 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2967 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2968 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2969 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2970 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2971 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2972 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2973 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2978 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2979 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2980 | { |
| 2981 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2982 | .name = "Channel Mode", |
| 2983 | .info = alc_ch_mode_info, |
| 2984 | .get = alc_ch_mode_get, |
| 2985 | .put = alc_ch_mode_put, |
| 2986 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2987 | { } /* end */ |
| 2988 | }; |
| 2989 | |
| 2990 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2991 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2992 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2993 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2994 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2995 | /* set capture source to mic-in */ |
| 2996 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2997 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2998 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2999 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3000 | /* speaker-out */ |
| 3001 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3002 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3003 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3004 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3005 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3006 | /* mic-in to input */ |
| 3007 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3008 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3009 | /* built-in mic */ |
| 3010 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3011 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3012 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3013 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3014 | { } |
| 3015 | }; |
| 3016 | |
| 3017 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3018 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3019 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3020 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3021 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3022 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3023 | spec->autocfg.speaker_pins[0] = 0x14; |
| 3024 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3025 | } |
| 3026 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3027 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3028 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3029 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3031 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3032 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3033 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3034 | { } /* end */ |
| 3035 | }; |
| 3036 | |
| 3037 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3038 | .num_items = 2, |
| 3039 | .items = { |
| 3040 | { "Mic", 0x0 }, |
| 3041 | { "Internal Mic", 0x1 }, |
| 3042 | }, |
| 3043 | }; |
| 3044 | |
| 3045 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3046 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3047 | |
| 3048 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3049 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3050 | |
| 3051 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3052 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3053 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3054 | /* Mic2 (as headphone out) for HP output */ |
| 3055 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3056 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3057 | /* Internal Speaker */ |
| 3058 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3059 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3060 | |
| 3061 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3062 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3063 | |
| 3064 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3065 | { } |
| 3066 | }; |
| 3067 | |
| 3068 | /* toggle speaker-output according to the hp-jack state */ |
| 3069 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3070 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3071 | struct alc_spec *spec = codec->spec; |
| 3072 | alc_automute_amp(codec); |
| 3073 | /* toggle EAPD */ |
| 3074 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3075 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3076 | else |
| 3077 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3078 | } |
| 3079 | |
| 3080 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3081 | unsigned int res) |
| 3082 | { |
| 3083 | /* Looks like the unsol event is incompatible with the standard |
| 3084 | * definition. 4bit tag is placed at 28 bit! |
| 3085 | */ |
| 3086 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3087 | alc880_medion_rim_automute(codec); |
| 3088 | } |
| 3089 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3090 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 3091 | { |
| 3092 | struct alc_spec *spec = codec->spec; |
| 3093 | |
| 3094 | spec->autocfg.hp_pins[0] = 0x14; |
| 3095 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 3096 | alc880_medion_rim_automute(codec); |
| 3097 | } |
| 3098 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3099 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3100 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3101 | { 0x0b, HDA_INPUT, 0 }, |
| 3102 | { 0x0b, HDA_INPUT, 1 }, |
| 3103 | { 0x0b, HDA_INPUT, 2 }, |
| 3104 | { 0x0b, HDA_INPUT, 3 }, |
| 3105 | { 0x0b, HDA_INPUT, 4 }, |
| 3106 | { } /* end */ |
| 3107 | }; |
| 3108 | |
| 3109 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3110 | { 0x0b, HDA_INPUT, 1 }, |
| 3111 | { 0x0b, HDA_INPUT, 6 }, |
| 3112 | { 0x0b, HDA_INPUT, 7 }, |
| 3113 | { } /* end */ |
| 3114 | }; |
| 3115 | #endif |
| 3116 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3117 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3118 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3119 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3120 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3121 | static int alc_init(struct hda_codec *codec) |
| 3122 | { |
| 3123 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3124 | unsigned int i; |
| 3125 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3126 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3127 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3128 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3129 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3130 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3131 | |
| 3132 | if (spec->init_hook) |
| 3133 | spec->init_hook(codec); |
| 3134 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3135 | return 0; |
| 3136 | } |
| 3137 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3138 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3139 | { |
| 3140 | struct alc_spec *spec = codec->spec; |
| 3141 | |
| 3142 | if (spec->unsol_event) |
| 3143 | spec->unsol_event(codec, res); |
| 3144 | } |
| 3145 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3146 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3147 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3148 | { |
| 3149 | struct alc_spec *spec = codec->spec; |
| 3150 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3151 | } |
| 3152 | #endif |
| 3153 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3154 | /* |
| 3155 | * Analog playback callbacks |
| 3156 | */ |
| 3157 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3158 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3159 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3160 | { |
| 3161 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3162 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3163 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3164 | } |
| 3165 | |
| 3166 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3167 | struct hda_codec *codec, |
| 3168 | unsigned int stream_tag, |
| 3169 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3170 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3171 | { |
| 3172 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3173 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3174 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3175 | } |
| 3176 | |
| 3177 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3178 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3179 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3180 | { |
| 3181 | struct alc_spec *spec = codec->spec; |
| 3182 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3183 | } |
| 3184 | |
| 3185 | /* |
| 3186 | * Digital out |
| 3187 | */ |
| 3188 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3189 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3190 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3191 | { |
| 3192 | struct alc_spec *spec = codec->spec; |
| 3193 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3194 | } |
| 3195 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3196 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3197 | struct hda_codec *codec, |
| 3198 | unsigned int stream_tag, |
| 3199 | unsigned int format, |
| 3200 | struct snd_pcm_substream *substream) |
| 3201 | { |
| 3202 | struct alc_spec *spec = codec->spec; |
| 3203 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3204 | stream_tag, format, substream); |
| 3205 | } |
| 3206 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3207 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3208 | struct hda_codec *codec, |
| 3209 | struct snd_pcm_substream *substream) |
| 3210 | { |
| 3211 | struct alc_spec *spec = codec->spec; |
| 3212 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3213 | } |
| 3214 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3215 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3216 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3217 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3218 | { |
| 3219 | struct alc_spec *spec = codec->spec; |
| 3220 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3221 | } |
| 3222 | |
| 3223 | /* |
| 3224 | * Analog capture |
| 3225 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3226 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3227 | struct hda_codec *codec, |
| 3228 | unsigned int stream_tag, |
| 3229 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3230 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3231 | { |
| 3232 | struct alc_spec *spec = codec->spec; |
| 3233 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3234 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3235 | stream_tag, 0, format); |
| 3236 | return 0; |
| 3237 | } |
| 3238 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3239 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3240 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3241 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3242 | { |
| 3243 | struct alc_spec *spec = codec->spec; |
| 3244 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3245 | snd_hda_codec_cleanup_stream(codec, |
| 3246 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3247 | return 0; |
| 3248 | } |
| 3249 | |
| 3250 | |
| 3251 | /* |
| 3252 | */ |
| 3253 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3254 | .substreams = 1, |
| 3255 | .channels_min = 2, |
| 3256 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3257 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3258 | .ops = { |
| 3259 | .open = alc880_playback_pcm_open, |
| 3260 | .prepare = alc880_playback_pcm_prepare, |
| 3261 | .cleanup = alc880_playback_pcm_cleanup |
| 3262 | }, |
| 3263 | }; |
| 3264 | |
| 3265 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3266 | .substreams = 1, |
| 3267 | .channels_min = 2, |
| 3268 | .channels_max = 2, |
| 3269 | /* NID is set in alc_build_pcms */ |
| 3270 | }; |
| 3271 | |
| 3272 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3273 | .substreams = 1, |
| 3274 | .channels_min = 2, |
| 3275 | .channels_max = 2, |
| 3276 | /* NID is set in alc_build_pcms */ |
| 3277 | }; |
| 3278 | |
| 3279 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3280 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3281 | .channels_min = 2, |
| 3282 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3283 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3284 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3285 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3286 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3287 | }, |
| 3288 | }; |
| 3289 | |
| 3290 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3291 | .substreams = 1, |
| 3292 | .channels_min = 2, |
| 3293 | .channels_max = 2, |
| 3294 | /* NID is set in alc_build_pcms */ |
| 3295 | .ops = { |
| 3296 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3297 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3298 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3299 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3300 | }, |
| 3301 | }; |
| 3302 | |
| 3303 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3304 | .substreams = 1, |
| 3305 | .channels_min = 2, |
| 3306 | .channels_max = 2, |
| 3307 | /* NID is set in alc_build_pcms */ |
| 3308 | }; |
| 3309 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3310 | /* 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] | 3311 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3312 | .substreams = 0, |
| 3313 | .channels_min = 0, |
| 3314 | .channels_max = 0, |
| 3315 | }; |
| 3316 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3317 | static int alc_build_pcms(struct hda_codec *codec) |
| 3318 | { |
| 3319 | struct alc_spec *spec = codec->spec; |
| 3320 | struct hda_pcm *info = spec->pcm_rec; |
| 3321 | int i; |
| 3322 | |
| 3323 | codec->num_pcms = 1; |
| 3324 | codec->pcm_info = info; |
| 3325 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3326 | if (spec->no_analog) |
| 3327 | goto skip_analog; |
| 3328 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3329 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3330 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3331 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3332 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3333 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3334 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3335 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3336 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3337 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3338 | } |
| 3339 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3340 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3341 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3342 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3343 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3344 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3345 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3346 | if (spec->channel_mode) { |
| 3347 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3348 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3349 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3350 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3351 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3352 | } |
| 3353 | } |
| 3354 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3355 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3356 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3357 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3358 | snprintf(spec->stream_name_digital, |
| 3359 | sizeof(spec->stream_name_digital), |
| 3360 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3361 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3362 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3363 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3364 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3365 | if (spec->dig_out_type) |
| 3366 | info->pcm_type = spec->dig_out_type; |
| 3367 | else |
| 3368 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3369 | if (spec->multiout.dig_out_nid && |
| 3370 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3371 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3372 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3373 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3374 | if (spec->dig_in_nid && |
| 3375 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3376 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3377 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3378 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3379 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3380 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | } |
| 3382 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3383 | if (spec->no_analog) |
| 3384 | return 0; |
| 3385 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3386 | /* If the use of more than one ADC is requested for the current |
| 3387 | * model, configure a second analog capture-only PCM. |
| 3388 | */ |
| 3389 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3390 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3391 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3392 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3393 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3394 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3395 | if (spec->alt_dac_nid) { |
| 3396 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3397 | *spec->stream_analog_alt_playback; |
| 3398 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3399 | spec->alt_dac_nid; |
| 3400 | } else { |
| 3401 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3402 | alc_pcm_null_stream; |
| 3403 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3404 | } |
| 3405 | if (spec->num_adc_nids > 1) { |
| 3406 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3407 | *spec->stream_analog_alt_capture; |
| 3408 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3409 | spec->adc_nids[1]; |
| 3410 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3411 | spec->num_adc_nids - 1; |
| 3412 | } else { |
| 3413 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3414 | alc_pcm_null_stream; |
| 3415 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3416 | } |
| 3417 | } |
| 3418 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3419 | return 0; |
| 3420 | } |
| 3421 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3422 | static void alc_free_kctls(struct hda_codec *codec) |
| 3423 | { |
| 3424 | struct alc_spec *spec = codec->spec; |
| 3425 | |
| 3426 | if (spec->kctls.list) { |
| 3427 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3428 | int i; |
| 3429 | for (i = 0; i < spec->kctls.used; i++) |
| 3430 | kfree(kctl[i].name); |
| 3431 | } |
| 3432 | snd_array_free(&spec->kctls); |
| 3433 | } |
| 3434 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3435 | static void alc_free(struct hda_codec *codec) |
| 3436 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3437 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3438 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3439 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3440 | return; |
| 3441 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3442 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3443 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3444 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3445 | } |
| 3446 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3447 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3448 | static int alc_resume(struct hda_codec *codec) |
| 3449 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3450 | codec->patch_ops.init(codec); |
| 3451 | snd_hda_codec_resume_amp(codec); |
| 3452 | snd_hda_codec_resume_cache(codec); |
| 3453 | return 0; |
| 3454 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3455 | #endif |
| 3456 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3457 | /* |
| 3458 | */ |
| 3459 | static struct hda_codec_ops alc_patch_ops = { |
| 3460 | .build_controls = alc_build_controls, |
| 3461 | .build_pcms = alc_build_pcms, |
| 3462 | .init = alc_init, |
| 3463 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3464 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3465 | #ifdef SND_HDA_NEEDS_RESUME |
| 3466 | .resume = alc_resume, |
| 3467 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3468 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3469 | .check_power_status = alc_check_power_status, |
| 3470 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3471 | }; |
| 3472 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3473 | |
| 3474 | /* |
| 3475 | * Test configuration for debugging |
| 3476 | * |
| 3477 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3478 | * enum controls. |
| 3479 | */ |
| 3480 | #ifdef CONFIG_SND_DEBUG |
| 3481 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3482 | 0x02, 0x03, 0x04, 0x05 |
| 3483 | }; |
| 3484 | |
| 3485 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3486 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3487 | .items = { |
| 3488 | { "In-1", 0x0 }, |
| 3489 | { "In-2", 0x1 }, |
| 3490 | { "In-3", 0x2 }, |
| 3491 | { "In-4", 0x3 }, |
| 3492 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3493 | { "Front", 0x5 }, |
| 3494 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3495 | }, |
| 3496 | }; |
| 3497 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3498 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3499 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3500 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3501 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3502 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3503 | }; |
| 3504 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3505 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3506 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3507 | { |
| 3508 | static char *texts[] = { |
| 3509 | "N/A", "Line Out", "HP Out", |
| 3510 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3511 | }; |
| 3512 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3513 | uinfo->count = 1; |
| 3514 | uinfo->value.enumerated.items = 8; |
| 3515 | if (uinfo->value.enumerated.item >= 8) |
| 3516 | uinfo->value.enumerated.item = 7; |
| 3517 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3518 | return 0; |
| 3519 | } |
| 3520 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3521 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3522 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3523 | { |
| 3524 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3525 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3526 | unsigned int pin_ctl, item = 0; |
| 3527 | |
| 3528 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3529 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3530 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3531 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3532 | item = 2; |
| 3533 | else |
| 3534 | item = 1; |
| 3535 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3536 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3537 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3538 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3539 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3540 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3541 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3542 | } |
| 3543 | } |
| 3544 | ucontrol->value.enumerated.item[0] = item; |
| 3545 | return 0; |
| 3546 | } |
| 3547 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3548 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3549 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3550 | { |
| 3551 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3552 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3553 | static unsigned int ctls[] = { |
| 3554 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3555 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3556 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3557 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3558 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3559 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3560 | }; |
| 3561 | unsigned int old_ctl, new_ctl; |
| 3562 | |
| 3563 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3564 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3565 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3566 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3567 | int val; |
| 3568 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3569 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3570 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3571 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3572 | HDA_AMP_MUTE : 0; |
| 3573 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3574 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3575 | return 1; |
| 3576 | } |
| 3577 | return 0; |
| 3578 | } |
| 3579 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3580 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3581 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3582 | { |
| 3583 | static char *texts[] = { |
| 3584 | "Front", "Surround", "CLFE", "Side" |
| 3585 | }; |
| 3586 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3587 | uinfo->count = 1; |
| 3588 | uinfo->value.enumerated.items = 4; |
| 3589 | if (uinfo->value.enumerated.item >= 4) |
| 3590 | uinfo->value.enumerated.item = 3; |
| 3591 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3592 | return 0; |
| 3593 | } |
| 3594 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3595 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3596 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3597 | { |
| 3598 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3599 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3600 | unsigned int sel; |
| 3601 | |
| 3602 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3603 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3604 | return 0; |
| 3605 | } |
| 3606 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3607 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3608 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3609 | { |
| 3610 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3611 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3612 | unsigned int sel; |
| 3613 | |
| 3614 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3615 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3616 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3617 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3618 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3619 | return 1; |
| 3620 | } |
| 3621 | return 0; |
| 3622 | } |
| 3623 | |
| 3624 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3625 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3626 | .name = xname, \ |
| 3627 | .info = alc_test_pin_ctl_info, \ |
| 3628 | .get = alc_test_pin_ctl_get, \ |
| 3629 | .put = alc_test_pin_ctl_put, \ |
| 3630 | .private_value = nid \ |
| 3631 | } |
| 3632 | |
| 3633 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3634 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3635 | .name = xname, \ |
| 3636 | .info = alc_test_pin_src_info, \ |
| 3637 | .get = alc_test_pin_src_get, \ |
| 3638 | .put = alc_test_pin_src_put, \ |
| 3639 | .private_value = nid \ |
| 3640 | } |
| 3641 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3642 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3643 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3644 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3645 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3646 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3647 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3648 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3649 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3650 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3651 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3652 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3653 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3654 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3655 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3656 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3657 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3658 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3659 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3660 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3661 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3662 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3663 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3664 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3665 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3666 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3667 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3668 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3669 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3670 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3671 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3672 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3673 | { |
| 3674 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3675 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3676 | .info = alc_ch_mode_info, |
| 3677 | .get = alc_ch_mode_get, |
| 3678 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3679 | }, |
| 3680 | { } /* end */ |
| 3681 | }; |
| 3682 | |
| 3683 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3684 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3685 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3686 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3687 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3688 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3689 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3690 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3691 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3692 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3693 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3695 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3696 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3697 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3698 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3699 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3700 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3701 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3702 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3703 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3704 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3705 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3706 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3707 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3708 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3709 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3710 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3711 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3712 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3713 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3714 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3715 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3716 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3717 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3718 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3719 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3720 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3721 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3722 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3723 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3724 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3725 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3726 | /* Analog input/passthru */ |
| 3727 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3728 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3729 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3730 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3731 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3732 | { } |
| 3733 | }; |
| 3734 | #endif |
| 3735 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3736 | /* |
| 3737 | */ |
| 3738 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3739 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3740 | [ALC880_3ST] = "3stack", |
| 3741 | [ALC880_TCL_S700] = "tcl", |
| 3742 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3743 | [ALC880_CLEVO] = "clevo", |
| 3744 | [ALC880_5ST] = "5stack", |
| 3745 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3746 | [ALC880_W810] = "w810", |
| 3747 | [ALC880_Z71V] = "z71v", |
| 3748 | [ALC880_6ST] = "6stack", |
| 3749 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3750 | [ALC880_ASUS] = "asus", |
| 3751 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3752 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3753 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3754 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3755 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3756 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3757 | [ALC880_F1734] = "F1734", |
| 3758 | [ALC880_LG] = "lg", |
| 3759 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3760 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3761 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3762 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3763 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3764 | [ALC880_AUTO] = "auto", |
| 3765 | }; |
| 3766 | |
| 3767 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3768 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3769 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3770 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3771 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3772 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3773 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3774 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3775 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3776 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3777 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3778 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3779 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3780 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3781 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3782 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3783 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3784 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3785 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3786 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3787 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3788 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3789 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3790 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3791 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3792 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3793 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3794 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3795 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3796 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3797 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3798 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3799 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3800 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3801 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3802 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3803 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3804 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3805 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3806 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3807 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3808 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3809 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3810 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3811 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3812 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3813 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3814 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3815 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3816 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3817 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3818 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3819 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3820 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3821 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3822 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3823 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3824 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3825 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3826 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3827 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3828 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3829 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3830 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3831 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3832 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3833 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3834 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3835 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3836 | /* default Intel */ |
| 3837 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3838 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3839 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3840 | {} |
| 3841 | }; |
| 3842 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3843 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3844 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3845 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3846 | static struct alc_config_preset alc880_presets[] = { |
| 3847 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3848 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3849 | .init_verbs = { alc880_volume_init_verbs, |
| 3850 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3851 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3852 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3853 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3854 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3855 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3856 | .input_mux = &alc880_capture_source, |
| 3857 | }, |
| 3858 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3859 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3860 | .init_verbs = { alc880_volume_init_verbs, |
| 3861 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3862 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3863 | .dac_nids = alc880_dac_nids, |
| 3864 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3865 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3866 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3867 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3868 | .input_mux = &alc880_capture_source, |
| 3869 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3870 | [ALC880_TCL_S700] = { |
| 3871 | .mixers = { alc880_tcl_s700_mixer }, |
| 3872 | .init_verbs = { alc880_volume_init_verbs, |
| 3873 | alc880_pin_tcl_S700_init_verbs, |
| 3874 | alc880_gpio2_init_verbs }, |
| 3875 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3876 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3877 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3878 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3879 | .hp_nid = 0x03, |
| 3880 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3881 | .channel_mode = alc880_2_jack_modes, |
| 3882 | .input_mux = &alc880_capture_source, |
| 3883 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3884 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3885 | .mixers = { alc880_three_stack_mixer, |
| 3886 | alc880_five_stack_mixer}, |
| 3887 | .init_verbs = { alc880_volume_init_verbs, |
| 3888 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3889 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3890 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3891 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3892 | .channel_mode = alc880_fivestack_modes, |
| 3893 | .input_mux = &alc880_capture_source, |
| 3894 | }, |
| 3895 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3896 | .mixers = { alc880_three_stack_mixer, |
| 3897 | alc880_five_stack_mixer }, |
| 3898 | .init_verbs = { alc880_volume_init_verbs, |
| 3899 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3900 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3901 | .dac_nids = alc880_dac_nids, |
| 3902 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3903 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3904 | .channel_mode = alc880_fivestack_modes, |
| 3905 | .input_mux = &alc880_capture_source, |
| 3906 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3907 | [ALC880_6ST] = { |
| 3908 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3909 | .init_verbs = { alc880_volume_init_verbs, |
| 3910 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3911 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3912 | .dac_nids = alc880_6st_dac_nids, |
| 3913 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3914 | .channel_mode = alc880_sixstack_modes, |
| 3915 | .input_mux = &alc880_6stack_capture_source, |
| 3916 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3917 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3918 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3919 | .init_verbs = { alc880_volume_init_verbs, |
| 3920 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3921 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3922 | .dac_nids = alc880_6st_dac_nids, |
| 3923 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3924 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3925 | .channel_mode = alc880_sixstack_modes, |
| 3926 | .input_mux = &alc880_6stack_capture_source, |
| 3927 | }, |
| 3928 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3929 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3930 | .init_verbs = { alc880_volume_init_verbs, |
| 3931 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3932 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3933 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3934 | .dac_nids = alc880_w810_dac_nids, |
| 3935 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3936 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3937 | .channel_mode = alc880_w810_modes, |
| 3938 | .input_mux = &alc880_capture_source, |
| 3939 | }, |
| 3940 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3941 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3942 | .init_verbs = { alc880_volume_init_verbs, |
| 3943 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3944 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3945 | .dac_nids = alc880_z71v_dac_nids, |
| 3946 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3947 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3948 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3949 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3950 | .input_mux = &alc880_capture_source, |
| 3951 | }, |
| 3952 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3953 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3954 | .init_verbs = { alc880_volume_init_verbs, |
| 3955 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3956 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3957 | .dac_nids = alc880_f1734_dac_nids, |
| 3958 | .hp_nid = 0x02, |
| 3959 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3960 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3961 | .input_mux = &alc880_f1734_capture_source, |
| 3962 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3963 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3964 | }, |
| 3965 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3966 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3967 | .init_verbs = { alc880_volume_init_verbs, |
| 3968 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3969 | alc880_gpio1_init_verbs }, |
| 3970 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3971 | .dac_nids = alc880_asus_dac_nids, |
| 3972 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3973 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3974 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3975 | .input_mux = &alc880_capture_source, |
| 3976 | }, |
| 3977 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3978 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3979 | .init_verbs = { alc880_volume_init_verbs, |
| 3980 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3981 | alc880_gpio1_init_verbs }, |
| 3982 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3983 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3984 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3985 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3986 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3987 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3988 | .input_mux = &alc880_capture_source, |
| 3989 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3990 | [ALC880_ASUS_DIG2] = { |
| 3991 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3992 | .init_verbs = { alc880_volume_init_verbs, |
| 3993 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3994 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3995 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3996 | .dac_nids = alc880_asus_dac_nids, |
| 3997 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3998 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3999 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4000 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4001 | .input_mux = &alc880_capture_source, |
| 4002 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4003 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4004 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4005 | .init_verbs = { alc880_volume_init_verbs, |
| 4006 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4007 | alc880_gpio1_init_verbs }, |
| 4008 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4009 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4010 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4011 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4012 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4013 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4014 | .input_mux = &alc880_capture_source, |
| 4015 | }, |
| 4016 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4017 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4018 | .init_verbs = { alc880_volume_init_verbs, |
| 4019 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4020 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4021 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4022 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4023 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4024 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4025 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4026 | .input_mux = &alc880_capture_source, |
| 4027 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4028 | [ALC880_UNIWILL] = { |
| 4029 | .mixers = { alc880_uniwill_mixer }, |
| 4030 | .init_verbs = { alc880_volume_init_verbs, |
| 4031 | alc880_uniwill_init_verbs }, |
| 4032 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4033 | .dac_nids = alc880_asus_dac_nids, |
| 4034 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4035 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4036 | .channel_mode = alc880_threestack_modes, |
| 4037 | .need_dac_fix = 1, |
| 4038 | .input_mux = &alc880_capture_source, |
| 4039 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4040 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4041 | }, |
| 4042 | [ALC880_UNIWILL_P53] = { |
| 4043 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4044 | .init_verbs = { alc880_volume_init_verbs, |
| 4045 | alc880_uniwill_p53_init_verbs }, |
| 4046 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4047 | .dac_nids = alc880_asus_dac_nids, |
| 4048 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4049 | .channel_mode = alc880_threestack_modes, |
| 4050 | .input_mux = &alc880_capture_source, |
| 4051 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4052 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4053 | }, |
| 4054 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4055 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4056 | .init_verbs = { alc880_volume_init_verbs, |
| 4057 | alc880_uniwill_p53_init_verbs, |
| 4058 | alc880_beep_init_verbs }, |
| 4059 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4060 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4061 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4062 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4063 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4064 | .input_mux = &alc880_capture_source, |
| 4065 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4066 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4067 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4068 | [ALC880_CLEVO] = { |
| 4069 | .mixers = { alc880_three_stack_mixer }, |
| 4070 | .init_verbs = { alc880_volume_init_verbs, |
| 4071 | alc880_pin_clevo_init_verbs }, |
| 4072 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4073 | .dac_nids = alc880_dac_nids, |
| 4074 | .hp_nid = 0x03, |
| 4075 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4076 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4077 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4078 | .input_mux = &alc880_capture_source, |
| 4079 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4080 | [ALC880_LG] = { |
| 4081 | .mixers = { alc880_lg_mixer }, |
| 4082 | .init_verbs = { alc880_volume_init_verbs, |
| 4083 | alc880_lg_init_verbs }, |
| 4084 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4085 | .dac_nids = alc880_lg_dac_nids, |
| 4086 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4087 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4088 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4089 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4090 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4091 | .unsol_event = alc_automute_amp_unsol_event, |
| 4092 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4093 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4094 | .loopbacks = alc880_lg_loopbacks, |
| 4095 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4096 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4097 | [ALC880_LG_LW] = { |
| 4098 | .mixers = { alc880_lg_lw_mixer }, |
| 4099 | .init_verbs = { alc880_volume_init_verbs, |
| 4100 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4101 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4102 | .dac_nids = alc880_dac_nids, |
| 4103 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4104 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4105 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4106 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4107 | .unsol_event = alc_automute_amp_unsol_event, |
| 4108 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4109 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4110 | [ALC880_MEDION_RIM] = { |
| 4111 | .mixers = { alc880_medion_rim_mixer }, |
| 4112 | .init_verbs = { alc880_volume_init_verbs, |
| 4113 | alc880_medion_rim_init_verbs, |
| 4114 | alc_gpio2_init_verbs }, |
| 4115 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4116 | .dac_nids = alc880_dac_nids, |
| 4117 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4118 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4119 | .channel_mode = alc880_2_jack_modes, |
| 4120 | .input_mux = &alc880_medion_rim_capture_source, |
| 4121 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4122 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4123 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4124 | #ifdef CONFIG_SND_DEBUG |
| 4125 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4126 | .mixers = { alc880_test_mixer }, |
| 4127 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4128 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4129 | .dac_nids = alc880_test_dac_nids, |
| 4130 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4131 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4132 | .channel_mode = alc880_test_modes, |
| 4133 | .input_mux = &alc880_test_capture_source, |
| 4134 | }, |
| 4135 | #endif |
| 4136 | }; |
| 4137 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4138 | /* |
| 4139 | * Automatic parse of I/O pins from the BIOS configuration |
| 4140 | */ |
| 4141 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4142 | enum { |
| 4143 | ALC_CTL_WIDGET_VOL, |
| 4144 | ALC_CTL_WIDGET_MUTE, |
| 4145 | ALC_CTL_BIND_MUTE, |
| 4146 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4147 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4148 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4149 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4150 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4151 | }; |
| 4152 | |
| 4153 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4154 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4155 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4156 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4157 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4158 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4159 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4160 | knew = snd_array_new(&spec->kctls); |
| 4161 | if (!knew) |
| 4162 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4163 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4164 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4165 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4166 | return -ENOMEM; |
| 4167 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4168 | return 0; |
| 4169 | } |
| 4170 | |
| 4171 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4172 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4173 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4174 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4175 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4176 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4177 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4178 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4179 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4180 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4181 | #define ALC880_PIN_CD_NID 0x1c |
| 4182 | |
| 4183 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4184 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4185 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4186 | { |
| 4187 | hda_nid_t nid; |
| 4188 | int assigned[4]; |
| 4189 | int i, j; |
| 4190 | |
| 4191 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4192 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4193 | |
| 4194 | /* check the pins hardwired to audio widget */ |
| 4195 | for (i = 0; i < cfg->line_outs; i++) { |
| 4196 | nid = cfg->line_out_pins[i]; |
| 4197 | if (alc880_is_fixed_pin(nid)) { |
| 4198 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4199 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4200 | assigned[idx] = 1; |
| 4201 | } |
| 4202 | } |
| 4203 | /* left pins can be connect to any audio widget */ |
| 4204 | for (i = 0; i < cfg->line_outs; i++) { |
| 4205 | nid = cfg->line_out_pins[i]; |
| 4206 | if (alc880_is_fixed_pin(nid)) |
| 4207 | continue; |
| 4208 | /* search for an empty channel */ |
| 4209 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4210 | if (!assigned[j]) { |
| 4211 | spec->multiout.dac_nids[i] = |
| 4212 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4213 | assigned[j] = 1; |
| 4214 | break; |
| 4215 | } |
| 4216 | } |
| 4217 | } |
| 4218 | spec->multiout.num_dacs = cfg->line_outs; |
| 4219 | return 0; |
| 4220 | } |
| 4221 | |
| 4222 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4223 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4224 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4225 | { |
| 4226 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4227 | static const char *chname[4] = { |
| 4228 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4229 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4230 | hda_nid_t nid; |
| 4231 | int i, err; |
| 4232 | |
| 4233 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4234 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4235 | continue; |
| 4236 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4237 | if (i == 2) { |
| 4238 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4239 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4240 | "Center Playback Volume", |
| 4241 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4242 | HDA_OUTPUT)); |
| 4243 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4244 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4245 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4246 | "LFE Playback Volume", |
| 4247 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4248 | HDA_OUTPUT)); |
| 4249 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4250 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4251 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4252 | "Center Playback Switch", |
| 4253 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4254 | HDA_INPUT)); |
| 4255 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4256 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4257 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4258 | "LFE Playback Switch", |
| 4259 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4260 | HDA_INPUT)); |
| 4261 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4262 | return err; |
| 4263 | } else { |
| 4264 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4265 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4266 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4267 | HDA_OUTPUT)); |
| 4268 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4269 | return err; |
| 4270 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4271 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4272 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4273 | HDA_INPUT)); |
| 4274 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4275 | return err; |
| 4276 | } |
| 4277 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4278 | return 0; |
| 4279 | } |
| 4280 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4281 | /* add playback controls for speaker and HP outputs */ |
| 4282 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4283 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4284 | { |
| 4285 | hda_nid_t nid; |
| 4286 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4287 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4288 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4289 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4290 | return 0; |
| 4291 | |
| 4292 | if (alc880_is_fixed_pin(pin)) { |
| 4293 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4294 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4295 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4296 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4297 | else |
| 4298 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4299 | /* control HP volume/switch on the output mixer amp */ |
| 4300 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4301 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4302 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4303 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4304 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4305 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4306 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4307 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4308 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4309 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4310 | return err; |
| 4311 | } else if (alc880_is_multi_pin(pin)) { |
| 4312 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4313 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4314 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4315 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4316 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4317 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4318 | return err; |
| 4319 | } |
| 4320 | return 0; |
| 4321 | } |
| 4322 | |
| 4323 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4324 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4325 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4326 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4327 | { |
| 4328 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4329 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4330 | |
| 4331 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4332 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4333 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4334 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4335 | return err; |
| 4336 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4337 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4338 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4339 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4340 | return err; |
| 4341 | return 0; |
| 4342 | } |
| 4343 | |
| 4344 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4345 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4346 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4347 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4348 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4349 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4350 | |
| 4351 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4352 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4353 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4354 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4355 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4356 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | if (err < 0) |
| 4358 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4359 | imux->items[imux->num_items].label = |
| 4360 | auto_pin_cfg_labels[i]; |
| 4361 | imux->items[imux->num_items].index = |
| 4362 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4363 | imux->num_items++; |
| 4364 | } |
| 4365 | } |
| 4366 | return 0; |
| 4367 | } |
| 4368 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4369 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4370 | unsigned int pin_type) |
| 4371 | { |
| 4372 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4373 | pin_type); |
| 4374 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4375 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4376 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4377 | } |
| 4378 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4379 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4380 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4381 | int dac_idx) |
| 4382 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4383 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4384 | /* need the manual connection? */ |
| 4385 | if (alc880_is_multi_pin(nid)) { |
| 4386 | struct alc_spec *spec = codec->spec; |
| 4387 | int idx = alc880_multi_pin_idx(nid); |
| 4388 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4389 | AC_VERB_SET_CONNECT_SEL, |
| 4390 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4391 | } |
| 4392 | } |
| 4393 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4394 | static int get_pin_type(int line_out_type) |
| 4395 | { |
| 4396 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4397 | return PIN_HP; |
| 4398 | else |
| 4399 | return PIN_OUT; |
| 4400 | } |
| 4401 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4402 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4403 | { |
| 4404 | struct alc_spec *spec = codec->spec; |
| 4405 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4406 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4407 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4408 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4409 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4410 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4411 | } |
| 4412 | } |
| 4413 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4414 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4415 | { |
| 4416 | struct alc_spec *spec = codec->spec; |
| 4417 | hda_nid_t pin; |
| 4418 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4419 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4420 | if (pin) /* connect to front */ |
| 4421 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4422 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4423 | if (pin) /* connect to front */ |
| 4424 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4425 | } |
| 4426 | |
| 4427 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4428 | { |
| 4429 | struct alc_spec *spec = codec->spec; |
| 4430 | int i; |
| 4431 | |
| 4432 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4433 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4434 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4435 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4436 | if (nid != ALC880_PIN_CD_NID && |
| 4437 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4438 | snd_hda_codec_write(codec, nid, 0, |
| 4439 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4440 | AMP_OUT_MUTE); |
| 4441 | } |
| 4442 | } |
| 4443 | } |
| 4444 | |
| 4445 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4446 | /* return 1 if successful, 0 if the proper config is not found, |
| 4447 | * or a negative error code |
| 4448 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4449 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4450 | { |
| 4451 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4452 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4453 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4456 | alc880_ignore); |
| 4457 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4458 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4459 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4460 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4461 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4462 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4463 | if (err < 0) |
| 4464 | return err; |
| 4465 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4466 | if (err < 0) |
| 4467 | return err; |
| 4468 | err = alc880_auto_create_extra_out(spec, |
| 4469 | spec->autocfg.speaker_pins[0], |
| 4470 | "Speaker"); |
| 4471 | if (err < 0) |
| 4472 | return err; |
| 4473 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4474 | "Headphone"); |
| 4475 | if (err < 0) |
| 4476 | return err; |
| 4477 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4478 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4479 | return err; |
| 4480 | |
| 4481 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4482 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4483 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4484 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4485 | hda_nid_t dig_nid; |
| 4486 | err = snd_hda_get_connections(codec, |
| 4487 | spec->autocfg.dig_out_pins[i], |
| 4488 | &dig_nid, 1); |
| 4489 | if (err < 0) |
| 4490 | continue; |
| 4491 | if (!i) |
| 4492 | spec->multiout.dig_out_nid = dig_nid; |
| 4493 | else { |
| 4494 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4495 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4496 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4497 | break; |
| 4498 | } |
| 4499 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4500 | if (spec->autocfg.dig_in_pin) |
| 4501 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4502 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4503 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4504 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4505 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4506 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4507 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4508 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4509 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4510 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4511 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4512 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4513 | return 1; |
| 4514 | } |
| 4515 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4516 | /* additional initialization for auto-configuration model */ |
| 4517 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4518 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4519 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4520 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4521 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4522 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4523 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4524 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4525 | } |
| 4526 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4527 | static void set_capture_mixer(struct alc_spec *spec) |
| 4528 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4529 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4530 | { alc_capture_mixer_nosrc1, |
| 4531 | alc_capture_mixer_nosrc2, |
| 4532 | alc_capture_mixer_nosrc3 }, |
| 4533 | { alc_capture_mixer1, |
| 4534 | alc_capture_mixer2, |
| 4535 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4536 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4537 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4538 | int mux; |
| 4539 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4540 | mux = 1; |
| 4541 | else |
| 4542 | mux = 0; |
| 4543 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4544 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4545 | } |
| 4546 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4547 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4548 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4549 | |
| 4550 | /* |
| 4551 | * OK, here we have finally the patch for ALC880 |
| 4552 | */ |
| 4553 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4554 | static int patch_alc880(struct hda_codec *codec) |
| 4555 | { |
| 4556 | struct alc_spec *spec; |
| 4557 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4558 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4559 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4560 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4561 | if (spec == NULL) |
| 4562 | return -ENOMEM; |
| 4563 | |
| 4564 | codec->spec = spec; |
| 4565 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4566 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4567 | alc880_models, |
| 4568 | alc880_cfg_tbl); |
| 4569 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 4570 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 4571 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4572 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4573 | } |
| 4574 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4575 | if (board_config == ALC880_AUTO) { |
| 4576 | /* automatic parse from the BIOS config */ |
| 4577 | err = alc880_parse_auto_config(codec); |
| 4578 | if (err < 0) { |
| 4579 | alc_free(codec); |
| 4580 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4581 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4582 | printk(KERN_INFO |
| 4583 | "hda_codec: Cannot set up configuration " |
| 4584 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4585 | board_config = ALC880_3ST; |
| 4586 | } |
| 4587 | } |
| 4588 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4589 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4590 | if (err < 0) { |
| 4591 | alc_free(codec); |
| 4592 | return err; |
| 4593 | } |
| 4594 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4595 | if (board_config != ALC880_AUTO) |
| 4596 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4597 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4598 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4599 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4600 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4601 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4602 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4603 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4604 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4605 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4606 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4607 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4608 | /* get type */ |
| 4609 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4610 | if (wcap != AC_WID_AUD_IN) { |
| 4611 | spec->adc_nids = alc880_adc_nids_alt; |
| 4612 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4613 | } else { |
| 4614 | spec->adc_nids = alc880_adc_nids; |
| 4615 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4616 | } |
| 4617 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4618 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4619 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4620 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4621 | spec->vmaster_nid = 0x0c; |
| 4622 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4623 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4624 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4625 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4626 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4627 | if (!spec->loopback.amplist) |
| 4628 | spec->loopback.amplist = alc880_loopbacks; |
| 4629 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4630 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4631 | |
| 4632 | return 0; |
| 4633 | } |
| 4634 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4635 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4636 | /* |
| 4637 | * ALC260 support |
| 4638 | */ |
| 4639 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4640 | static hda_nid_t alc260_dac_nids[1] = { |
| 4641 | /* front */ |
| 4642 | 0x02, |
| 4643 | }; |
| 4644 | |
| 4645 | static hda_nid_t alc260_adc_nids[1] = { |
| 4646 | /* ADC0 */ |
| 4647 | 0x04, |
| 4648 | }; |
| 4649 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4650 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4651 | /* ADC1 */ |
| 4652 | 0x05, |
| 4653 | }; |
| 4654 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4655 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4656 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4657 | */ |
| 4658 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4659 | /* ADC0, ADC1 */ |
| 4660 | 0x04, 0x05 |
| 4661 | }; |
| 4662 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4663 | #define ALC260_DIGOUT_NID 0x03 |
| 4664 | #define ALC260_DIGIN_NID 0x06 |
| 4665 | |
| 4666 | static struct hda_input_mux alc260_capture_source = { |
| 4667 | .num_items = 4, |
| 4668 | .items = { |
| 4669 | { "Mic", 0x0 }, |
| 4670 | { "Front Mic", 0x1 }, |
| 4671 | { "Line", 0x2 }, |
| 4672 | { "CD", 0x4 }, |
| 4673 | }, |
| 4674 | }; |
| 4675 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4676 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4677 | * headphone jack and the internal CD lines since these are the only pins at |
| 4678 | * which audio can appear. For flexibility, also allow the option of |
| 4679 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4680 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4681 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4682 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4683 | { |
| 4684 | .num_items = 3, |
| 4685 | .items = { |
| 4686 | { "Mic/Line", 0x0 }, |
| 4687 | { "CD", 0x4 }, |
| 4688 | { "Headphone", 0x2 }, |
| 4689 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4690 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4691 | { |
| 4692 | .num_items = 4, |
| 4693 | .items = { |
| 4694 | { "Mic/Line", 0x0 }, |
| 4695 | { "CD", 0x4 }, |
| 4696 | { "Headphone", 0x2 }, |
| 4697 | { "Mixer", 0x5 }, |
| 4698 | }, |
| 4699 | }, |
| 4700 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4701 | }; |
| 4702 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4703 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4704 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4705 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4706 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4707 | { |
| 4708 | .num_items = 4, |
| 4709 | .items = { |
| 4710 | { "Mic", 0x0 }, |
| 4711 | { "Line", 0x2 }, |
| 4712 | { "CD", 0x4 }, |
| 4713 | { "Headphone", 0x5 }, |
| 4714 | }, |
| 4715 | }, |
| 4716 | { |
| 4717 | .num_items = 5, |
| 4718 | .items = { |
| 4719 | { "Mic", 0x0 }, |
| 4720 | { "Line", 0x2 }, |
| 4721 | { "CD", 0x4 }, |
| 4722 | { "Headphone", 0x6 }, |
| 4723 | { "Mixer", 0x5 }, |
| 4724 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4725 | }, |
| 4726 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4727 | |
| 4728 | /* Maxdata Favorit 100XS */ |
| 4729 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4730 | { |
| 4731 | .num_items = 2, |
| 4732 | .items = { |
| 4733 | { "Line/Mic", 0x0 }, |
| 4734 | { "CD", 0x4 }, |
| 4735 | }, |
| 4736 | }, |
| 4737 | { |
| 4738 | .num_items = 3, |
| 4739 | .items = { |
| 4740 | { "Line/Mic", 0x0 }, |
| 4741 | { "CD", 0x4 }, |
| 4742 | { "Mixer", 0x5 }, |
| 4743 | }, |
| 4744 | }, |
| 4745 | }; |
| 4746 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4747 | /* |
| 4748 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4749 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4750 | * element which allows changing the channel mode, so the verb list is |
| 4751 | * never used. |
| 4752 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4753 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4754 | { 2, NULL }, |
| 4755 | }; |
| 4756 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4757 | |
| 4758 | /* Mixer combinations |
| 4759 | * |
| 4760 | * basic: base_output + input + pc_beep + capture |
| 4761 | * HP: base_output + input + capture_alt |
| 4762 | * HP_3013: hp_3013 + input + capture |
| 4763 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4764 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4765 | */ |
| 4766 | |
| 4767 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4768 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4769 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4770 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4771 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4772 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4773 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4774 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4775 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4776 | |
| 4777 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4778 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4779 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4780 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4781 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4784 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4785 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4786 | { } /* end */ |
| 4787 | }; |
| 4788 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4789 | /* update HP, line and mono out pins according to the master switch */ |
| 4790 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4791 | hda_nid_t hp, hda_nid_t line, |
| 4792 | hda_nid_t mono) |
| 4793 | { |
| 4794 | struct alc_spec *spec = codec->spec; |
| 4795 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4796 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4797 | 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] | 4798 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4799 | 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] | 4800 | val); |
| 4801 | /* mono (speaker) depending on the HP jack sense */ |
| 4802 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4803 | 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] | 4804 | val); |
| 4805 | } |
| 4806 | |
| 4807 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4808 | struct snd_ctl_elem_value *ucontrol) |
| 4809 | { |
| 4810 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4811 | struct alc_spec *spec = codec->spec; |
| 4812 | *ucontrol->value.integer.value = spec->master_sw; |
| 4813 | return 0; |
| 4814 | } |
| 4815 | |
| 4816 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4817 | struct snd_ctl_elem_value *ucontrol) |
| 4818 | { |
| 4819 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4820 | struct alc_spec *spec = codec->spec; |
| 4821 | int val = !!*ucontrol->value.integer.value; |
| 4822 | hda_nid_t hp, line, mono; |
| 4823 | |
| 4824 | if (val == spec->master_sw) |
| 4825 | return 0; |
| 4826 | spec->master_sw = val; |
| 4827 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4828 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4829 | mono = kcontrol->private_value & 0xff; |
| 4830 | alc260_hp_master_update(codec, hp, line, mono); |
| 4831 | return 1; |
| 4832 | } |
| 4833 | |
| 4834 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4835 | { |
| 4836 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4837 | .name = "Master Playback Switch", |
| 4838 | .info = snd_ctl_boolean_mono_info, |
| 4839 | .get = alc260_hp_master_sw_get, |
| 4840 | .put = alc260_hp_master_sw_put, |
| 4841 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4842 | }, |
| 4843 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4844 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4845 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4846 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4847 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4848 | HDA_OUTPUT), |
| 4849 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4850 | { } /* end */ |
| 4851 | }; |
| 4852 | |
| 4853 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4854 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4855 | {}, |
| 4856 | }; |
| 4857 | |
| 4858 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4859 | { |
| 4860 | struct alc_spec *spec = codec->spec; |
| 4861 | unsigned int present; |
| 4862 | |
| 4863 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4864 | AC_VERB_GET_PIN_SENSE, 0); |
| 4865 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4866 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4867 | } |
| 4868 | |
| 4869 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4870 | { |
| 4871 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4872 | alc260_hp_automute(codec); |
| 4873 | } |
| 4874 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4875 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4876 | { |
| 4877 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4878 | .name = "Master Playback Switch", |
| 4879 | .info = snd_ctl_boolean_mono_info, |
| 4880 | .get = alc260_hp_master_sw_get, |
| 4881 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4882 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4883 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4884 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4885 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4886 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4887 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4888 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4890 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4891 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4892 | { } /* end */ |
| 4893 | }; |
| 4894 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4895 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4896 | .ops = &snd_hda_bind_vol, |
| 4897 | .values = { |
| 4898 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4899 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4900 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4901 | 0 |
| 4902 | }, |
| 4903 | }; |
| 4904 | |
| 4905 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4906 | .ops = &snd_hda_bind_sw, |
| 4907 | .values = { |
| 4908 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4909 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4910 | 0 |
| 4911 | }, |
| 4912 | }; |
| 4913 | |
| 4914 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4915 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4916 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4917 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4918 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4919 | { } /* end */ |
| 4920 | }; |
| 4921 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4922 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4923 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4924 | {}, |
| 4925 | }; |
| 4926 | |
| 4927 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4928 | { |
| 4929 | struct alc_spec *spec = codec->spec; |
| 4930 | unsigned int present; |
| 4931 | |
| 4932 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4933 | AC_VERB_GET_PIN_SENSE, 0); |
| 4934 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4935 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4936 | } |
| 4937 | |
| 4938 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4939 | unsigned int res) |
| 4940 | { |
| 4941 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4942 | alc260_hp_3013_automute(codec); |
| 4943 | } |
| 4944 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4945 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4946 | { |
| 4947 | unsigned int present, bits; |
| 4948 | |
| 4949 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4950 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4951 | |
| 4952 | bits = present ? 0 : PIN_OUT; |
| 4953 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4954 | bits); |
| 4955 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4956 | bits); |
| 4957 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4958 | bits); |
| 4959 | } |
| 4960 | |
| 4961 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4962 | unsigned int res) |
| 4963 | { |
| 4964 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4965 | alc260_hp_3012_automute(codec); |
| 4966 | } |
| 4967 | |
| 4968 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4969 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4970 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4971 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4972 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4973 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4974 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4975 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4976 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4977 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4978 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4979 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4980 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4981 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4982 | { } /* end */ |
| 4983 | }; |
| 4984 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4985 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4986 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4987 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4988 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4989 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4990 | * revisions available in early 2006. Therefore for now allow the |
| 4991 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4992 | * that the lack of mic bias for this NID is intentional we could change the |
| 4993 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4994 | * |
| 4995 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4996 | * don't appear to make the mic bias available from the "line" jack, even |
| 4997 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4998 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4999 | * and the output jack. If this turns out to be the case for all such |
| 5000 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5001 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5002 | * |
| 5003 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5004 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5005 | * controls for such models. On models without a "mono speaker" the control |
| 5006 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5007 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5008 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5009 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5010 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5011 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5012 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5013 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5014 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5015 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5016 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5017 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5019 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5020 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5021 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5022 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5023 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5024 | { } /* end */ |
| 5025 | }; |
| 5026 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5027 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5028 | */ |
| 5029 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5030 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5031 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5032 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5033 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5034 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5035 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5036 | { } /* end */ |
| 5037 | }; |
| 5038 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5039 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5040 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5041 | */ |
| 5042 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5043 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5044 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5047 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5049 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5050 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5051 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5052 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5053 | { } /* end */ |
| 5054 | }; |
| 5055 | |
| 5056 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5057 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5058 | */ |
| 5059 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5060 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5061 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5064 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5065 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5066 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5067 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5068 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5069 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5070 | { } /* end */ |
| 5071 | }; |
| 5072 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5073 | /* |
| 5074 | * initialization verbs |
| 5075 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5076 | static struct hda_verb alc260_init_verbs[] = { |
| 5077 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5078 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5079 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5080 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5081 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5082 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5083 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5084 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5085 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5086 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5087 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5088 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5089 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5090 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5091 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5092 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5093 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5094 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5095 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5096 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5097 | /* set connection select to line in (default select for this ADC) */ |
| 5098 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5099 | /* mute capture amp left and right */ |
| 5100 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5101 | /* set connection select to line in (default select for this ADC) */ |
| 5102 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5103 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5104 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5105 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5107 | /* set vol=0 HP mixer amp left and right */ |
| 5108 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5109 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5110 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5111 | /* set vol=0 Mono mixer amp left and right */ |
| 5112 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5113 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5114 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5115 | /* unmute LINE-2 out pin */ |
| 5116 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5117 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5118 | * Line In 2 = 0x03 |
| 5119 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5120 | /* mute analog inputs */ |
| 5121 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5122 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5123 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5124 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5126 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5127 | /* mute Front out path */ |
| 5128 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5129 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5130 | /* mute Headphone out path */ |
| 5131 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5132 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5133 | /* mute Mono out path */ |
| 5134 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5135 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5136 | { } |
| 5137 | }; |
| 5138 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5139 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5140 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5141 | /* Headphone and output */ |
| 5142 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5143 | /* mono output */ |
| 5144 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5145 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5146 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5147 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5148 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5149 | /* Line In pin widget for input */ |
| 5150 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5151 | /* Line-2 pin widget for output */ |
| 5152 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5153 | /* CD pin widget for input */ |
| 5154 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5155 | /* unmute amp left and right */ |
| 5156 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5157 | /* set connection select to line in (default select for this ADC) */ |
| 5158 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5159 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5160 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5161 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5162 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5163 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5164 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5165 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5166 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5167 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5168 | * Line In 2 = 0x03 |
| 5169 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5170 | /* mute analog inputs */ |
| 5171 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5172 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5173 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5174 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5175 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5176 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5177 | /* Unmute Front out path */ |
| 5178 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5179 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5180 | /* Unmute Headphone out path */ |
| 5181 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5182 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5183 | /* Unmute Mono out path */ |
| 5184 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5185 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5186 | { } |
| 5187 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5188 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5189 | |
| 5190 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5191 | /* Line out and output */ |
| 5192 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5193 | /* mono output */ |
| 5194 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5195 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5196 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5197 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5198 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5199 | /* Line In pin widget for input */ |
| 5200 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5201 | /* Headphone pin widget for output */ |
| 5202 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5203 | /* CD pin widget for input */ |
| 5204 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5205 | /* unmute amp left and right */ |
| 5206 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5207 | /* set connection select to line in (default select for this ADC) */ |
| 5208 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5209 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5210 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5211 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5212 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5213 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5214 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5215 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5216 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5217 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5218 | * Line In 2 = 0x03 |
| 5219 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5220 | /* mute analog inputs */ |
| 5221 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5222 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5223 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5224 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5225 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5226 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5227 | /* Unmute Front out path */ |
| 5228 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5229 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5230 | /* Unmute Headphone out path */ |
| 5231 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5232 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5233 | /* Unmute Mono out path */ |
| 5234 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5235 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5236 | { } |
| 5237 | }; |
| 5238 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5239 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5240 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5241 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5242 | */ |
| 5243 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5244 | /* Disable all GPIOs */ |
| 5245 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5246 | /* Internal speaker is connected to headphone pin */ |
| 5247 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5248 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5249 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5250 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5251 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5252 | /* Ensure all other unused pins are disabled and muted. */ |
| 5253 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5254 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5255 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5256 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5257 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5258 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5259 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5260 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5261 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5262 | /* Disable digital (SPDIF) pins */ |
| 5263 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5264 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5265 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5266 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5267 | * when acting as an output. |
| 5268 | */ |
| 5269 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5270 | |
| 5271 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5272 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5273 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5274 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5275 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5276 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5277 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5278 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5279 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5280 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5281 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5282 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5283 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5284 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5285 | * If the pin mode is changed by the user the pin mode control will |
| 5286 | * take care of enabling the pin's input/output buffers as needed. |
| 5287 | * Therefore there's no need to enable the input buffer at this |
| 5288 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5289 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5290 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5291 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5292 | * mixer ctrl) |
| 5293 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5294 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5295 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5296 | /* Mute capture amp left and right */ |
| 5297 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5298 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5299 | * in (on mic1 pin) |
| 5300 | */ |
| 5301 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5302 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5303 | /* Do the same for the second ADC: mute capture input amp and |
| 5304 | * set ADC connection to line in (on mic1 pin) |
| 5305 | */ |
| 5306 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5307 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5308 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5309 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5312 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5313 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5314 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5315 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5316 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5317 | {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] | 5318 | |
| 5319 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5320 | }; |
| 5321 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5322 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5323 | * similar laptops (adapted from Fujitsu init verbs). |
| 5324 | */ |
| 5325 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5326 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5327 | * the headphone jack. Turn this on and rely on the standard mute |
| 5328 | * methods whenever the user wants to turn these outputs off. |
| 5329 | */ |
| 5330 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5331 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5332 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5333 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5334 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5335 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5336 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5337 | /* Line In jack is connected to Line1 pin */ |
| 5338 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5339 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5340 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5341 | /* Ensure all other unused pins are disabled and muted. */ |
| 5342 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5343 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5344 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5345 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5346 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5347 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5348 | /* Disable digital (SPDIF) pins */ |
| 5349 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5350 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5351 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5352 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5353 | * bus when acting as outputs. |
| 5354 | */ |
| 5355 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5356 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5357 | |
| 5358 | /* Start with output sum widgets muted and their output gains at min */ |
| 5359 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5360 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5361 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5362 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5363 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5364 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5365 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5366 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5367 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5368 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5369 | /* Unmute Line-out pin widget amp left and right |
| 5370 | * (no equiv mixer ctrl) |
| 5371 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5372 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5373 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5374 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5375 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5376 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5377 | * will take care of enabling the pin's input/output buffers as needed. |
| 5378 | * Therefore there's no need to enable the input buffer at this |
| 5379 | * stage. |
| 5380 | */ |
| 5381 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5382 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5383 | |
| 5384 | /* Mute capture amp left and right */ |
| 5385 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5386 | /* Set ADC connection select to match default mixer setting - mic |
| 5387 | * (on mic1 pin) |
| 5388 | */ |
| 5389 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5390 | |
| 5391 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5392 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5393 | */ |
| 5394 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5395 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5396 | |
| 5397 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5403 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5404 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5405 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5406 | |
| 5407 | { } |
| 5408 | }; |
| 5409 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5410 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5411 | * (adapted from Acer init verbs). |
| 5412 | */ |
| 5413 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5414 | /* GPIO 0 enables the output jack. |
| 5415 | * Turn this on and rely on the standard mute |
| 5416 | * methods whenever the user wants to turn these outputs off. |
| 5417 | */ |
| 5418 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5419 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5420 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5421 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5422 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5423 | /* Ensure all other unused pins are disabled and muted. */ |
| 5424 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5425 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5426 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5427 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5428 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5429 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5430 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5431 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5432 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5433 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5434 | /* Disable digital (SPDIF) pins */ |
| 5435 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5436 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5437 | |
| 5438 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5439 | * bus when acting as outputs. |
| 5440 | */ |
| 5441 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5442 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5443 | |
| 5444 | /* Start with output sum widgets muted and their output gains at min */ |
| 5445 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5447 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5448 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5449 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5450 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5451 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5452 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5453 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5454 | |
| 5455 | /* Unmute Line-out pin widget amp left and right |
| 5456 | * (no equiv mixer ctrl) |
| 5457 | */ |
| 5458 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5459 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5460 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5461 | * will take care of enabling the pin's input/output buffers as needed. |
| 5462 | * Therefore there's no need to enable the input buffer at this |
| 5463 | * stage. |
| 5464 | */ |
| 5465 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5466 | |
| 5467 | /* Mute capture amp left and right */ |
| 5468 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5469 | /* Set ADC connection select to match default mixer setting - mic |
| 5470 | * (on mic1 pin) |
| 5471 | */ |
| 5472 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5473 | |
| 5474 | /* Do similar with the second ADC: mute capture input amp and |
| 5475 | * set ADC connection to mic to match ALSA's default state. |
| 5476 | */ |
| 5477 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5478 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5479 | |
| 5480 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5481 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5482 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5483 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5484 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5489 | |
| 5490 | { } |
| 5491 | }; |
| 5492 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5493 | static struct hda_verb alc260_will_verbs[] = { |
| 5494 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5495 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5496 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5497 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5498 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5499 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5500 | {} |
| 5501 | }; |
| 5502 | |
| 5503 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5504 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5505 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5506 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5507 | |
| 5508 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5509 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5510 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5511 | |
| 5512 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5513 | {} |
| 5514 | }; |
| 5515 | |
| 5516 | /* toggle speaker-output according to the hp-jack state */ |
| 5517 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5518 | { |
| 5519 | unsigned int present; |
| 5520 | |
| 5521 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5522 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5523 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5524 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5525 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5526 | AC_VERB_SET_GPIO_DATA, 1); |
| 5527 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5528 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5529 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5530 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5531 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5532 | AC_VERB_SET_GPIO_DATA, 0); |
| 5533 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5534 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5535 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5536 | } |
| 5537 | } |
| 5538 | |
| 5539 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5540 | unsigned int res) |
| 5541 | { |
| 5542 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5543 | alc260_replacer_672v_automute(codec); |
| 5544 | } |
| 5545 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5546 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5547 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5548 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5549 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5550 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5551 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5552 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5553 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5554 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5555 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5556 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5557 | {} |
| 5558 | }; |
| 5559 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5560 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5561 | * configuration. |
| 5562 | */ |
| 5563 | #ifdef CONFIG_SND_DEBUG |
| 5564 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5565 | 0x02, |
| 5566 | }; |
| 5567 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5568 | 0x04, 0x05, |
| 5569 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5570 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5571 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5572 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5573 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5574 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5575 | { |
| 5576 | .num_items = 7, |
| 5577 | .items = { |
| 5578 | { "MIC1 pin", 0x0 }, |
| 5579 | { "MIC2 pin", 0x1 }, |
| 5580 | { "LINE1 pin", 0x2 }, |
| 5581 | { "LINE2 pin", 0x3 }, |
| 5582 | { "CD pin", 0x4 }, |
| 5583 | { "LINE-OUT pin", 0x5 }, |
| 5584 | { "HP-OUT pin", 0x6 }, |
| 5585 | }, |
| 5586 | }, |
| 5587 | { |
| 5588 | .num_items = 8, |
| 5589 | .items = { |
| 5590 | { "MIC1 pin", 0x0 }, |
| 5591 | { "MIC2 pin", 0x1 }, |
| 5592 | { "LINE1 pin", 0x2 }, |
| 5593 | { "LINE2 pin", 0x3 }, |
| 5594 | { "CD pin", 0x4 }, |
| 5595 | { "Mixer", 0x5 }, |
| 5596 | { "LINE-OUT pin", 0x6 }, |
| 5597 | { "HP-OUT pin", 0x7 }, |
| 5598 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5599 | }, |
| 5600 | }; |
| 5601 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5602 | /* Output driver widgets */ |
| 5603 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5604 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5605 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5606 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5607 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5608 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5609 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5610 | /* Modes for retasking pin widgets |
| 5611 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5612 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5613 | * mention this restriction. At this stage it's not clear whether |
| 5614 | * this behaviour is intentional or is a hardware bug in chip |
| 5615 | * revisions available at least up until early 2006. Therefore for |
| 5616 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5617 | * choices, but if it turns out that the lack of mic bias for these |
| 5618 | * NIDs is intentional we could change their modes from |
| 5619 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5620 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5621 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5622 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5623 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5624 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5625 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5626 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5627 | |
| 5628 | /* Loopback mixer controls */ |
| 5629 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5630 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5631 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5632 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5633 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5634 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5635 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5636 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5638 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5639 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5640 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5641 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5642 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5643 | |
| 5644 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5645 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5646 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5647 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5648 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5649 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5650 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5651 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5652 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5653 | */ |
| 5654 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5655 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5656 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5657 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5658 | * this output to turn on an external amplifier. |
| 5659 | */ |
| 5660 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5661 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5662 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5663 | { } /* end */ |
| 5664 | }; |
| 5665 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5666 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5667 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5668 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5669 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5670 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5671 | /* Enable retasking pins as output, initially without power amp */ |
| 5672 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5673 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5674 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5675 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5676 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5677 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5678 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5679 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5680 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5681 | * payload also sets the generation to 0, output to be in "consumer" |
| 5682 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5683 | * control. |
| 5684 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5685 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5686 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5687 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5688 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5689 | * OUT1 sum bus when acting as an output. |
| 5690 | */ |
| 5691 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5692 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5693 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5694 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5695 | |
| 5696 | /* Start with output sum widgets muted and their output gains at min */ |
| 5697 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5698 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5699 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5700 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5701 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5702 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5703 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5704 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5705 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5706 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5707 | /* Unmute retasking pin widget output buffers since the default |
| 5708 | * state appears to be output. As the pin mode is changed by the |
| 5709 | * user the pin mode control will take care of enabling the pin's |
| 5710 | * input/output buffers as needed. |
| 5711 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5712 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5713 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5714 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5715 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5716 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5717 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5718 | /* Also unmute the mono-out pin widget */ |
| 5719 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5720 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5721 | /* Mute capture amp left and right */ |
| 5722 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5723 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5724 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5725 | */ |
| 5726 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5727 | |
| 5728 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5729 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5730 | */ |
| 5731 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5732 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5733 | |
| 5734 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5735 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5737 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5738 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5739 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5741 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5742 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5743 | |
| 5744 | { } |
| 5745 | }; |
| 5746 | #endif |
| 5747 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5748 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5749 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5750 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5751 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5752 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5753 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5754 | /* |
| 5755 | * for BIOS auto-configuration |
| 5756 | */ |
| 5757 | |
| 5758 | 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] | 5759 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5760 | { |
| 5761 | hda_nid_t nid_vol; |
| 5762 | unsigned long vol_val, sw_val; |
| 5763 | char name[32]; |
| 5764 | int err; |
| 5765 | |
| 5766 | if (nid >= 0x0f && nid < 0x11) { |
| 5767 | nid_vol = nid - 0x7; |
| 5768 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5769 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5770 | } else if (nid == 0x11) { |
| 5771 | nid_vol = nid - 0x7; |
| 5772 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5773 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5774 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5775 | nid_vol = 0x08; |
| 5776 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5777 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5778 | } else |
| 5779 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5780 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5781 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5782 | /* first control for the volume widget */ |
| 5783 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5784 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5785 | if (err < 0) |
| 5786 | return err; |
| 5787 | *vol_bits |= (1 << nid_vol); |
| 5788 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5789 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5790 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5791 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5792 | return err; |
| 5793 | return 1; |
| 5794 | } |
| 5795 | |
| 5796 | /* add playback controls from the parsed DAC table */ |
| 5797 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5798 | const struct auto_pin_cfg *cfg) |
| 5799 | { |
| 5800 | hda_nid_t nid; |
| 5801 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5802 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5803 | |
| 5804 | spec->multiout.num_dacs = 1; |
| 5805 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5806 | spec->multiout.dac_nids[0] = 0x02; |
| 5807 | |
| 5808 | nid = cfg->line_out_pins[0]; |
| 5809 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5810 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5811 | if (err < 0) |
| 5812 | return err; |
| 5813 | } |
| 5814 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5815 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5816 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5817 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5818 | if (err < 0) |
| 5819 | return err; |
| 5820 | } |
| 5821 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5822 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5823 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5824 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5825 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5826 | if (err < 0) |
| 5827 | return err; |
| 5828 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5829 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5830 | } |
| 5831 | |
| 5832 | /* create playback/capture controls for input pins */ |
| 5833 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5834 | const struct auto_pin_cfg *cfg) |
| 5835 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5836 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5837 | int i, err, idx; |
| 5838 | |
| 5839 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5840 | if (cfg->input_pins[i] >= 0x12) { |
| 5841 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5842 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5843 | auto_pin_cfg_labels[i], idx, |
| 5844 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5845 | if (err < 0) |
| 5846 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5847 | imux->items[imux->num_items].label = |
| 5848 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5849 | imux->items[imux->num_items].index = idx; |
| 5850 | imux->num_items++; |
| 5851 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5852 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5853 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5854 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5855 | auto_pin_cfg_labels[i], idx, |
| 5856 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5857 | if (err < 0) |
| 5858 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5859 | imux->items[imux->num_items].label = |
| 5860 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5861 | imux->items[imux->num_items].index = idx; |
| 5862 | imux->num_items++; |
| 5863 | } |
| 5864 | } |
| 5865 | return 0; |
| 5866 | } |
| 5867 | |
| 5868 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5869 | hda_nid_t nid, int pin_type, |
| 5870 | int sel_idx) |
| 5871 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5872 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5873 | /* need the manual connection? */ |
| 5874 | if (nid >= 0x12) { |
| 5875 | int idx = nid - 0x12; |
| 5876 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5877 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5878 | } |
| 5879 | } |
| 5880 | |
| 5881 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5882 | { |
| 5883 | struct alc_spec *spec = codec->spec; |
| 5884 | hda_nid_t nid; |
| 5885 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5886 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5887 | if (nid) { |
| 5888 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5889 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5890 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5891 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5892 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5893 | if (nid) |
| 5894 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5895 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5896 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5897 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5898 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5899 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5900 | |
| 5901 | #define ALC260_PIN_CD_NID 0x16 |
| 5902 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5903 | { |
| 5904 | struct alc_spec *spec = codec->spec; |
| 5905 | int i; |
| 5906 | |
| 5907 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5908 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5909 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5910 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5911 | if (nid != ALC260_PIN_CD_NID && |
| 5912 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5913 | snd_hda_codec_write(codec, nid, 0, |
| 5914 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5915 | AMP_OUT_MUTE); |
| 5916 | } |
| 5917 | } |
| 5918 | } |
| 5919 | |
| 5920 | /* |
| 5921 | * generic initialization of ADC, input mixers and output mixers |
| 5922 | */ |
| 5923 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5924 | /* |
| 5925 | * Unmute ADC0-1 and set the default input to mic-in |
| 5926 | */ |
| 5927 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5928 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5929 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5930 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5931 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5932 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5933 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5934 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5935 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5936 | */ |
| 5937 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5938 | /* mute analog inputs */ |
| 5939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5940 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5941 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5942 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5943 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5944 | |
| 5945 | /* |
| 5946 | * Set up output mixers (0x08 - 0x0a) |
| 5947 | */ |
| 5948 | /* set vol=0 to output mixers */ |
| 5949 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5950 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5951 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5952 | /* set up input amps for analog loopback */ |
| 5953 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5954 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5955 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5956 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5957 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5958 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5959 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5961 | { } |
| 5962 | }; |
| 5963 | |
| 5964 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5965 | { |
| 5966 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5967 | int err; |
| 5968 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5969 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5970 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5971 | alc260_ignore); |
| 5972 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5973 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5974 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5975 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5976 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5977 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5978 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5979 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5980 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5981 | return err; |
| 5982 | |
| 5983 | spec->multiout.max_channels = 2; |
| 5984 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5985 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5986 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5987 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5988 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5989 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5990 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5991 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5992 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5993 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5994 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5995 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 5996 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5997 | return 1; |
| 5998 | } |
| 5999 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6000 | /* additional initialization for auto-configuration model */ |
| 6001 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6002 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6003 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6004 | alc260_auto_init_multi_out(codec); |
| 6005 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6006 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6007 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6008 | } |
| 6009 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6010 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6011 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6012 | { 0x07, HDA_INPUT, 0 }, |
| 6013 | { 0x07, HDA_INPUT, 1 }, |
| 6014 | { 0x07, HDA_INPUT, 2 }, |
| 6015 | { 0x07, HDA_INPUT, 3 }, |
| 6016 | { 0x07, HDA_INPUT, 4 }, |
| 6017 | { } /* end */ |
| 6018 | }; |
| 6019 | #endif |
| 6020 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6021 | /* |
| 6022 | * ALC260 configurations |
| 6023 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6024 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6025 | [ALC260_BASIC] = "basic", |
| 6026 | [ALC260_HP] = "hp", |
| 6027 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6028 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6029 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6030 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6031 | [ALC260_WILL] = "will", |
| 6032 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6033 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6034 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6035 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6036 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6037 | [ALC260_AUTO] = "auto", |
| 6038 | }; |
| 6039 | |
| 6040 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6041 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6042 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6043 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6044 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6045 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6046 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6047 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6048 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6049 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6050 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6051 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6052 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6053 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6054 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6055 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6056 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6057 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6058 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6059 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6060 | {} |
| 6061 | }; |
| 6062 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6063 | static struct alc_config_preset alc260_presets[] = { |
| 6064 | [ALC260_BASIC] = { |
| 6065 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6066 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6067 | .init_verbs = { alc260_init_verbs }, |
| 6068 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6069 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6070 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6071 | .adc_nids = alc260_adc_nids, |
| 6072 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6073 | .channel_mode = alc260_modes, |
| 6074 | .input_mux = &alc260_capture_source, |
| 6075 | }, |
| 6076 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6077 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6078 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6079 | .init_verbs = { alc260_init_verbs, |
| 6080 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6081 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6082 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6083 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6084 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6085 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6086 | .channel_mode = alc260_modes, |
| 6087 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6088 | .unsol_event = alc260_hp_unsol_event, |
| 6089 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6090 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6091 | [ALC260_HP_DC7600] = { |
| 6092 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6093 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6094 | .init_verbs = { alc260_init_verbs, |
| 6095 | alc260_hp_dc7600_verbs }, |
| 6096 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6097 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6098 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6099 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6100 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6101 | .channel_mode = alc260_modes, |
| 6102 | .input_mux = &alc260_capture_source, |
| 6103 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6104 | .init_hook = alc260_hp_3012_automute, |
| 6105 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6106 | [ALC260_HP_3013] = { |
| 6107 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6108 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6109 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6110 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6111 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6112 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6113 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6114 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6115 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6116 | .channel_mode = alc260_modes, |
| 6117 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6118 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6119 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6120 | }, |
| 6121 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6122 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6123 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6124 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6125 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6126 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6127 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6128 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6129 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6130 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6131 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6132 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6133 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6134 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6135 | .init_verbs = { alc260_acer_init_verbs }, |
| 6136 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6137 | .dac_nids = alc260_dac_nids, |
| 6138 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6139 | .adc_nids = alc260_dual_adc_nids, |
| 6140 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6141 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6142 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6143 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6144 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6145 | [ALC260_FAVORIT100] = { |
| 6146 | .mixers = { alc260_favorit100_mixer }, |
| 6147 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6148 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6149 | .dac_nids = alc260_dac_nids, |
| 6150 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6151 | .adc_nids = alc260_dual_adc_nids, |
| 6152 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6153 | .channel_mode = alc260_modes, |
| 6154 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6155 | .input_mux = alc260_favorit100_capture_sources, |
| 6156 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6157 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6158 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6159 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6160 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6161 | .dac_nids = alc260_dac_nids, |
| 6162 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6163 | .adc_nids = alc260_adc_nids, |
| 6164 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6165 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6166 | .channel_mode = alc260_modes, |
| 6167 | .input_mux = &alc260_capture_source, |
| 6168 | }, |
| 6169 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6170 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6171 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6172 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6173 | .dac_nids = alc260_dac_nids, |
| 6174 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6175 | .adc_nids = alc260_adc_nids, |
| 6176 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6177 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6178 | .channel_mode = alc260_modes, |
| 6179 | .input_mux = &alc260_capture_source, |
| 6180 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6181 | .init_hook = alc260_replacer_672v_automute, |
| 6182 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6183 | #ifdef CONFIG_SND_DEBUG |
| 6184 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6185 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6186 | .init_verbs = { alc260_test_init_verbs }, |
| 6187 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6188 | .dac_nids = alc260_test_dac_nids, |
| 6189 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6190 | .adc_nids = alc260_test_adc_nids, |
| 6191 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6192 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6193 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6194 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6195 | }, |
| 6196 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6197 | }; |
| 6198 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6199 | static int patch_alc260(struct hda_codec *codec) |
| 6200 | { |
| 6201 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6202 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6203 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6204 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6205 | if (spec == NULL) |
| 6206 | return -ENOMEM; |
| 6207 | |
| 6208 | codec->spec = spec; |
| 6209 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6210 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6211 | alc260_models, |
| 6212 | alc260_cfg_tbl); |
| 6213 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6214 | snd_printd(KERN_INFO "hda_codec: Unknown model for %s, " |
| 6215 | "trying auto-probe from BIOS...\n", |
| 6216 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6217 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6218 | } |
| 6219 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6220 | if (board_config == ALC260_AUTO) { |
| 6221 | /* automatic parse from the BIOS config */ |
| 6222 | err = alc260_parse_auto_config(codec); |
| 6223 | if (err < 0) { |
| 6224 | alc_free(codec); |
| 6225 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6226 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6227 | printk(KERN_INFO |
| 6228 | "hda_codec: Cannot set up configuration " |
| 6229 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6230 | board_config = ALC260_BASIC; |
| 6231 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6232 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6233 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6234 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6235 | if (err < 0) { |
| 6236 | alc_free(codec); |
| 6237 | return err; |
| 6238 | } |
| 6239 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6240 | if (board_config != ALC260_AUTO) |
| 6241 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6242 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6243 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6244 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6245 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6246 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6247 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6248 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6249 | if (!spec->adc_nids && spec->input_mux) { |
| 6250 | /* check whether NID 0x04 is valid */ |
| 6251 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6252 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6253 | /* get type */ |
| 6254 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6255 | spec->adc_nids = alc260_adc_nids_alt; |
| 6256 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6257 | } else { |
| 6258 | spec->adc_nids = alc260_adc_nids; |
| 6259 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6260 | } |
| 6261 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6262 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6263 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6264 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6265 | spec->vmaster_nid = 0x08; |
| 6266 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6267 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6268 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6269 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6270 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6271 | if (!spec->loopback.amplist) |
| 6272 | spec->loopback.amplist = alc260_loopbacks; |
| 6273 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6274 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6275 | |
| 6276 | return 0; |
| 6277 | } |
| 6278 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6279 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6280 | /* |
| 6281 | * ALC882 support |
| 6282 | * |
| 6283 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6284 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6285 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6286 | * 6-channel independent captures. |
| 6287 | * |
| 6288 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6289 | * driver yet). |
| 6290 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6291 | #define ALC882_DIGOUT_NID 0x06 |
| 6292 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6293 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6294 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6295 | { 8, NULL } |
| 6296 | }; |
| 6297 | |
| 6298 | static hda_nid_t alc882_dac_nids[4] = { |
| 6299 | /* front, rear, clfe, rear_surr */ |
| 6300 | 0x02, 0x03, 0x04, 0x05 |
| 6301 | }; |
| 6302 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6303 | /* identical with ALC880 */ |
| 6304 | #define alc882_adc_nids alc880_adc_nids |
| 6305 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6306 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6307 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6308 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6309 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6310 | /* input MUX */ |
| 6311 | /* FIXME: should be a matrix-type input source selection */ |
| 6312 | |
| 6313 | static struct hda_input_mux alc882_capture_source = { |
| 6314 | .num_items = 4, |
| 6315 | .items = { |
| 6316 | { "Mic", 0x0 }, |
| 6317 | { "Front Mic", 0x1 }, |
| 6318 | { "Line", 0x2 }, |
| 6319 | { "CD", 0x4 }, |
| 6320 | }, |
| 6321 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6322 | |
| 6323 | static struct hda_input_mux mb5_capture_source = { |
| 6324 | .num_items = 3, |
| 6325 | .items = { |
| 6326 | { "Mic", 0x1 }, |
| 6327 | { "Line", 0x2 }, |
| 6328 | { "CD", 0x4 }, |
| 6329 | }, |
| 6330 | }; |
| 6331 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6333 | * 2ch mode |
| 6334 | */ |
| 6335 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6336 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6337 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6338 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6339 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6340 | { } /* end */ |
| 6341 | }; |
| 6342 | |
| 6343 | /* |
| 6344 | * 6ch mode |
| 6345 | */ |
| 6346 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6347 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6348 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6349 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6350 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6351 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6352 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6353 | { } /* end */ |
| 6354 | }; |
| 6355 | |
| 6356 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6357 | { 2, alc882_3ST_ch2_init }, |
| 6358 | { 6, alc882_3ST_ch6_init }, |
| 6359 | }; |
| 6360 | |
| 6361 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6362 | * 6ch mode |
| 6363 | */ |
| 6364 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6365 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6366 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6367 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6368 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6369 | { } /* end */ |
| 6370 | }; |
| 6371 | |
| 6372 | /* |
| 6373 | * 8ch mode |
| 6374 | */ |
| 6375 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6376 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6377 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6378 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6379 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6380 | { } /* end */ |
| 6381 | }; |
| 6382 | |
| 6383 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6384 | { 6, alc882_sixstack_ch6_init }, |
| 6385 | { 8, alc882_sixstack_ch8_init }, |
| 6386 | }; |
| 6387 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6388 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6389 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6390 | */ |
| 6391 | |
| 6392 | /* |
| 6393 | * 2ch mode |
| 6394 | */ |
| 6395 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6396 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6397 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6398 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6399 | { } /* end */ |
| 6400 | }; |
| 6401 | |
| 6402 | /* |
| 6403 | * 6ch mode |
| 6404 | */ |
| 6405 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6406 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6407 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6408 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6409 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6410 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6411 | { } /* end */ |
| 6412 | }; |
| 6413 | |
| 6414 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6415 | { 2, alc885_mbp_ch2_init }, |
| 6416 | { 6, alc885_mbp_ch6_init }, |
| 6417 | }; |
| 6418 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6419 | /* |
| 6420 | * 2ch |
| 6421 | * Speakers/Woofer/HP = Front |
| 6422 | * LineIn = Input |
| 6423 | */ |
| 6424 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6425 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6427 | { } /* end */ |
| 6428 | }; |
| 6429 | |
| 6430 | /* |
| 6431 | * 6ch mode |
| 6432 | * Speakers/HP = Front |
| 6433 | * Woofer = LFE |
| 6434 | * LineIn = Surround |
| 6435 | */ |
| 6436 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6437 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6438 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6439 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6440 | { } /* end */ |
| 6441 | }; |
| 6442 | |
| 6443 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6444 | { 2, alc885_mb5_ch2_init }, |
| 6445 | { 6, alc885_mb5_ch6_init }, |
| 6446 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6447 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6448 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6449 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6450 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6451 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6452 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6453 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6454 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6455 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6456 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6457 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6458 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6459 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6460 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6461 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6464 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6465 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6466 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6468 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6470 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6471 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6472 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6473 | { } /* end */ |
| 6474 | }; |
| 6475 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6476 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6477 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6478 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6479 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6480 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6481 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6482 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6484 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6485 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6486 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6487 | { } /* end */ |
| 6488 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6489 | |
| 6490 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6491 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6492 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6493 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6494 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6495 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6496 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6497 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6498 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6500 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6502 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6503 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6504 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6505 | { } /* end */ |
| 6506 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6507 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6508 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6509 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6510 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6511 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6512 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6513 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6514 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6515 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6516 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6517 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6518 | { } /* end */ |
| 6519 | }; |
| 6520 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6521 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6522 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6523 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6524 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6525 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6526 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6527 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6528 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6531 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6532 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6533 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6534 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6535 | { } /* end */ |
| 6536 | }; |
| 6537 | |
| 6538 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6539 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6540 | */ |
| 6541 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6542 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6543 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6544 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6545 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6547 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6548 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6549 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6550 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6551 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6552 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6553 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6554 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6555 | { } /* end */ |
| 6556 | }; |
| 6557 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6558 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6559 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6560 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6561 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6562 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6563 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6564 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6565 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6566 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6567 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6568 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6569 | { } /* end */ |
| 6570 | }; |
| 6571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6572 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6573 | { |
| 6574 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6575 | .name = "Channel Mode", |
| 6576 | .info = alc_ch_mode_info, |
| 6577 | .get = alc_ch_mode_get, |
| 6578 | .put = alc_ch_mode_put, |
| 6579 | }, |
| 6580 | { } /* end */ |
| 6581 | }; |
| 6582 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6583 | static struct hda_verb alc882_init_verbs[] = { |
| 6584 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6588 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6590 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6591 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6592 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6594 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6595 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6596 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6597 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6598 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6599 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6600 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6601 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6602 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6603 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6604 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6605 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6606 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6607 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6608 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6609 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6610 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6611 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6612 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6613 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6614 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6615 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6616 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6617 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6618 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6619 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6620 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6621 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6622 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6623 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6624 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6625 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6626 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6627 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6628 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6629 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6630 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6631 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6632 | |
| 6633 | /* FIXME: use matrix-type input source selection */ |
| 6634 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6635 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6636 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6637 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6638 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6639 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6640 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6641 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6642 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6643 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6644 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6645 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6646 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6647 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6648 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6649 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6650 | /* ADC1: mute amp left and right */ |
| 6651 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6652 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6653 | /* ADC2: mute amp left and right */ |
| 6654 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6655 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6656 | /* ADC3: mute amp left and right */ |
| 6657 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6658 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6659 | |
| 6660 | { } |
| 6661 | }; |
| 6662 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6663 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6664 | /* change to EAPD mode */ |
| 6665 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6666 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6667 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6668 | }; |
| 6669 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6670 | /* Mac Pro test */ |
| 6671 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6672 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6673 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6674 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6676 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6677 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6678 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6679 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6680 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6681 | { } /* end */ |
| 6682 | }; |
| 6683 | |
| 6684 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6685 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6686 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6688 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6689 | /* Front Pin: output 0 (0x0c) */ |
| 6690 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6692 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6693 | /* Front Mic pin: input vref at 80% */ |
| 6694 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6695 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6696 | /* Speaker: output */ |
| 6697 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6698 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6699 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6700 | /* Headphone output (output 0 - 0x0c) */ |
| 6701 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6702 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6703 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6704 | |
| 6705 | /* FIXME: use matrix-type input source selection */ |
| 6706 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6707 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6708 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6709 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6710 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6711 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6712 | /* Input mixer2 */ |
| 6713 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6714 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6715 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6716 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6717 | /* Input mixer3 */ |
| 6718 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6719 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6721 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6722 | /* ADC1: mute amp left and right */ |
| 6723 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6724 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6725 | /* ADC2: mute amp left and right */ |
| 6726 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6727 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6728 | /* ADC3: mute amp left and right */ |
| 6729 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6730 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6731 | |
| 6732 | { } |
| 6733 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6734 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6735 | /* Macbook 5,1 */ |
| 6736 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6737 | /* DACs */ |
| 6738 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6739 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6740 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6741 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6742 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6743 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6746 | /* Surround mixer */ |
| 6747 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6748 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6749 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6750 | /* LFE mixer */ |
| 6751 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6752 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6753 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6754 | /* HP mixer */ |
| 6755 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6756 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6757 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6758 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6759 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6760 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6761 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6762 | /* LFE Pin (0x0e) */ |
| 6763 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6764 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6765 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6766 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6768 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6769 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6770 | /* Front Mic pin: input vref at 80% */ |
| 6771 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6772 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6773 | /* Line In pin */ |
| 6774 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6776 | |
| 6777 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6778 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6779 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6780 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6781 | { } |
| 6782 | }; |
| 6783 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6784 | /* Macbook Pro rev3 */ |
| 6785 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6786 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6788 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6789 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6790 | /* Rear mixer */ |
| 6791 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6792 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6793 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6794 | /* Front Pin: output 0 (0x0c) */ |
| 6795 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6796 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6797 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6798 | /* HP Pin: output 0 (0x0d) */ |
| 6799 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6800 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6801 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6802 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6803 | /* Mic (rear) pin: input vref at 80% */ |
| 6804 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6805 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6806 | /* Front Mic pin: input vref at 80% */ |
| 6807 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6808 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6809 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6810 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6811 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6812 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6813 | |
| 6814 | /* FIXME: use matrix-type input source selection */ |
| 6815 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6816 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6817 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6818 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6819 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6820 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6821 | /* Input mixer2 */ |
| 6822 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6823 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6824 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6825 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6826 | /* Input mixer3 */ |
| 6827 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6828 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6829 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6830 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6831 | /* ADC1: mute amp left and right */ |
| 6832 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6833 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6834 | /* ADC2: mute amp left and right */ |
| 6835 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6836 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6837 | /* ADC3: mute amp left and right */ |
| 6838 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6839 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6840 | |
| 6841 | { } |
| 6842 | }; |
| 6843 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6844 | /* iMac 24 mixer. */ |
| 6845 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6846 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6847 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6848 | { } /* end */ |
| 6849 | }; |
| 6850 | |
| 6851 | /* iMac 24 init verbs. */ |
| 6852 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6853 | /* Internal speakers: output 0 (0x0c) */ |
| 6854 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6855 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6856 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6857 | /* Internal speakers: output 0 (0x0c) */ |
| 6858 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6859 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6860 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6861 | /* Headphone: output 0 (0x0c) */ |
| 6862 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6863 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6864 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6865 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6866 | /* Front Mic: input vref at 80% */ |
| 6867 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6868 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6869 | { } |
| 6870 | }; |
| 6871 | |
| 6872 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6873 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6874 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6875 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6876 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6877 | spec->autocfg.hp_pins[0] = 0x14; |
| 6878 | spec->autocfg.speaker_pins[0] = 0x18; |
| 6879 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 6880 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6881 | } |
| 6882 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6883 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6884 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6885 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6886 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6887 | spec->autocfg.hp_pins[0] = 0x15; |
| 6888 | spec->autocfg.speaker_pins[0] = 0x14; |
| 6889 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6890 | } |
| 6891 | |
| 6892 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6893 | static struct hda_verb alc882_targa_verbs[] = { |
| 6894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6895 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6896 | |
| 6897 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6898 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6899 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6900 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6901 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6902 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6903 | |
| 6904 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6905 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6906 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6907 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6908 | { } /* end */ |
| 6909 | }; |
| 6910 | |
| 6911 | /* toggle speaker-output according to the hp-jack state */ |
| 6912 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6913 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6914 | struct alc_spec *spec = codec->spec; |
| 6915 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6916 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6917 | spec->jack_present ? 1 : 3); |
| 6918 | } |
| 6919 | |
| 6920 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 6921 | { |
| 6922 | struct alc_spec *spec = codec->spec; |
| 6923 | |
| 6924 | spec->autocfg.hp_pins[0] = 0x14; |
| 6925 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 6926 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6927 | } |
| 6928 | |
| 6929 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6930 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6931 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6932 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6933 | } |
| 6934 | |
| 6935 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6936 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6938 | |
| 6939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6940 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6941 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6942 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6943 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6944 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6945 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6946 | |
| 6947 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6948 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6949 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6950 | { } /* end */ |
| 6951 | }; |
| 6952 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6953 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6954 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6955 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6956 | |
| 6957 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6958 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6959 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6960 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6961 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6962 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6963 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6964 | |
| 6965 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6966 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6967 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6968 | { } /* end */ |
| 6969 | }; |
| 6970 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6971 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6972 | { |
| 6973 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6974 | |
| 6975 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6976 | AC_VERB_GET_GPIO_DATA, 0); |
| 6977 | |
| 6978 | if (!muted) |
| 6979 | gpiostate |= (1 << pin); |
| 6980 | else |
| 6981 | gpiostate &= ~(1 << pin); |
| 6982 | |
| 6983 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6984 | AC_VERB_GET_GPIO_MASK, 0); |
| 6985 | gpiomask |= (1 << pin); |
| 6986 | |
| 6987 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6988 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6989 | gpiodir |= (1 << pin); |
| 6990 | |
| 6991 | |
| 6992 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6993 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6994 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6995 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6996 | |
| 6997 | msleep(1); |
| 6998 | |
| 6999 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7000 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7001 | } |
| 7002 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7003 | /* set up GPIO at initialization */ |
| 7004 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7005 | { |
| 7006 | alc882_gpio_mute(codec, 0, 0); |
| 7007 | alc882_gpio_mute(codec, 1, 0); |
| 7008 | } |
| 7009 | |
| 7010 | /* set up GPIO and update auto-muting at initialization */ |
| 7011 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7012 | { |
| 7013 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7014 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7015 | } |
| 7016 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7017 | /* |
| 7018 | * generic initialization of ADC, input mixers and output mixers |
| 7019 | */ |
| 7020 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 7021 | /* |
| 7022 | * Unmute ADC0-2 and set the default input to mic-in |
| 7023 | */ |
| 7024 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7026 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7027 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7028 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7029 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7030 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7031 | /* 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] | 7032 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7033 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7034 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7035 | */ |
| 7036 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7042 | |
| 7043 | /* |
| 7044 | * Set up output mixers (0x0c - 0x0f) |
| 7045 | */ |
| 7046 | /* set vol=0 to output mixers */ |
| 7047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7050 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7051 | /* set up input amps for analog loopback */ |
| 7052 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7055 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7056 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7057 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7058 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7059 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7060 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7061 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7062 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7063 | |
| 7064 | /* FIXME: use matrix-type input source selection */ |
| 7065 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7066 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7067 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7068 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7070 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7071 | /* Input mixer2 */ |
| 7072 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7073 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7074 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7075 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7076 | /* Input mixer3 */ |
| 7077 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7081 | |
| 7082 | { } |
| 7083 | }; |
| 7084 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7085 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7086 | #define alc882_loopbacks alc880_loopbacks |
| 7087 | #endif |
| 7088 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7089 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7090 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 7091 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 7092 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 7093 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 7094 | |
| 7095 | /* |
| 7096 | * configuration and preset |
| 7097 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7098 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 7099 | [ALC882_3ST_DIG] = "3stack-dig", |
| 7100 | [ALC882_6ST_DIG] = "6stack-dig", |
| 7101 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7102 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 7103 | [ALC882_TARGA] = "targa", |
| 7104 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 7105 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7106 | [ALC885_MACPRO] = "macpro", |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7107 | [ALC885_MB5] = "mb5", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7108 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7109 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7110 | [ALC882_AUTO] = "auto", |
| 7111 | }; |
| 7112 | |
| 7113 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 7114 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7115 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 7116 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7117 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7118 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 7119 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 7120 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7121 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 7122 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7123 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 7124 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 7125 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7126 | {} |
| 7127 | }; |
| 7128 | |
| 7129 | static struct alc_config_preset alc882_presets[] = { |
| 7130 | [ALC882_3ST_DIG] = { |
| 7131 | .mixers = { alc882_base_mixer }, |
| 7132 | .init_verbs = { alc882_init_verbs }, |
| 7133 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7134 | .dac_nids = alc882_dac_nids, |
| 7135 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7136 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7137 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7138 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7139 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7140 | .input_mux = &alc882_capture_source, |
| 7141 | }, |
| 7142 | [ALC882_6ST_DIG] = { |
| 7143 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 7144 | .init_verbs = { alc882_init_verbs }, |
| 7145 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7146 | .dac_nids = alc882_dac_nids, |
| 7147 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7148 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7149 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 7150 | .channel_mode = alc882_sixstack_modes, |
| 7151 | .input_mux = &alc882_capture_source, |
| 7152 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7153 | [ALC882_ARIMA] = { |
| 7154 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 7155 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 7156 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7157 | .dac_nids = alc882_dac_nids, |
| 7158 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 7159 | .channel_mode = alc882_sixstack_modes, |
| 7160 | .input_mux = &alc882_capture_source, |
| 7161 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7162 | [ALC882_W2JC] = { |
| 7163 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 7164 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7165 | alc880_gpio1_init_verbs }, |
| 7166 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7167 | .dac_nids = alc882_dac_nids, |
| 7168 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7169 | .channel_mode = alc880_threestack_modes, |
| 7170 | .need_dac_fix = 1, |
| 7171 | .input_mux = &alc882_capture_source, |
| 7172 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7173 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7174 | [ALC885_MBP3] = { |
| 7175 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 7176 | .init_verbs = { alc885_mbp3_init_verbs, |
| 7177 | alc880_gpio1_init_verbs }, |
| 7178 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7179 | .dac_nids = alc882_dac_nids, |
| 7180 | .channel_mode = alc885_mbp_6ch_modes, |
| 7181 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 7182 | .input_mux = &alc882_capture_source, |
| 7183 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7184 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7185 | .unsol_event = alc_automute_amp_unsol_event, |
| 7186 | .init_hook = alc885_mbp3_init_hook, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7187 | }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7188 | [ALC885_MB5] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7189 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7190 | .init_verbs = { alc885_mb5_init_verbs, |
| 7191 | alc880_gpio1_init_verbs }, |
| 7192 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7193 | .dac_nids = alc882_dac_nids, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7194 | .channel_mode = alc885_mb5_6ch_modes, |
| 7195 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7196 | .input_mux = &mb5_capture_source, |
| 7197 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7198 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7199 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7200 | [ALC885_MACPRO] = { |
| 7201 | .mixers = { alc882_macpro_mixer }, |
| 7202 | .init_verbs = { alc882_macpro_init_verbs }, |
| 7203 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7204 | .dac_nids = alc882_dac_nids, |
| 7205 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7206 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7207 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7208 | .channel_mode = alc882_ch_modes, |
| 7209 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7210 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7211 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7212 | [ALC885_IMAC24] = { |
| 7213 | .mixers = { alc885_imac24_mixer }, |
| 7214 | .init_verbs = { alc885_imac24_init_verbs }, |
| 7215 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7216 | .dac_nids = alc882_dac_nids, |
| 7217 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7218 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7219 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7220 | .channel_mode = alc882_ch_modes, |
| 7221 | .input_mux = &alc882_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7222 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7223 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7224 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7225 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7226 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7227 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 7228 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7229 | .dac_nids = alc882_dac_nids, |
| 7230 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7231 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7232 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7233 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7234 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7235 | .channel_mode = alc882_3ST_6ch_modes, |
| 7236 | .need_dac_fix = 1, |
| 7237 | .input_mux = &alc882_capture_source, |
| 7238 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7239 | .init_hook = alc882_targa_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7240 | }, |
| 7241 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7242 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7243 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 7244 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7245 | .dac_nids = alc882_dac_nids, |
| 7246 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7247 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7248 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7249 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7250 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7251 | .channel_mode = alc882_3ST_6ch_modes, |
| 7252 | .need_dac_fix = 1, |
| 7253 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7254 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7255 | [ALC882_ASUS_A7M] = { |
| 7256 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 7257 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7258 | alc880_gpio1_init_verbs, |
| 7259 | alc882_asus_a7m_verbs }, |
| 7260 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7261 | .dac_nids = alc882_dac_nids, |
| 7262 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7263 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7264 | .channel_mode = alc880_threestack_modes, |
| 7265 | .need_dac_fix = 1, |
| 7266 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7267 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7268 | }; |
| 7269 | |
| 7270 | |
| 7271 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7272 | * Pin config fixes |
| 7273 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7274 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7275 | PINFIX_ABIT_AW9D_MAX |
| 7276 | }; |
| 7277 | |
| 7278 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 7279 | { 0x15, 0x01080104 }, /* side */ |
| 7280 | { 0x16, 0x01011012 }, /* rear */ |
| 7281 | { 0x17, 0x01016011 }, /* clfe */ |
| 7282 | { } |
| 7283 | }; |
| 7284 | |
| 7285 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 7286 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 7287 | }; |
| 7288 | |
| 7289 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 7290 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 7291 | {} |
| 7292 | }; |
| 7293 | |
| 7294 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7295 | * BIOS auto configuration |
| 7296 | */ |
| 7297 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7298 | hda_nid_t nid, int pin_type, |
| 7299 | int dac_idx) |
| 7300 | { |
| 7301 | /* set as output */ |
| 7302 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7303 | int idx; |
| 7304 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7305 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7306 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7307 | idx = 4; |
| 7308 | else |
| 7309 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7310 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7311 | |
| 7312 | } |
| 7313 | |
| 7314 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 7315 | { |
| 7316 | struct alc_spec *spec = codec->spec; |
| 7317 | int i; |
| 7318 | |
| 7319 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7320 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7321 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7322 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7323 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7324 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7325 | } |
| 7326 | } |
| 7327 | |
| 7328 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 7329 | { |
| 7330 | struct alc_spec *spec = codec->spec; |
| 7331 | hda_nid_t pin; |
| 7332 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7333 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7334 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7335 | /* use dac 0 */ |
| 7336 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7337 | pin = spec->autocfg.speaker_pins[0]; |
| 7338 | if (pin) |
| 7339 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7340 | } |
| 7341 | |
| 7342 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7343 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7344 | |
| 7345 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7346 | { |
| 7347 | struct alc_spec *spec = codec->spec; |
| 7348 | int i; |
| 7349 | |
| 7350 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7351 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7352 | if (!nid) |
| 7353 | continue; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 7354 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7355 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7356 | snd_hda_codec_write(codec, nid, 0, |
| 7357 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7358 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7359 | } |
| 7360 | } |
| 7361 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7362 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7363 | { |
| 7364 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7365 | int c; |
| 7366 | |
| 7367 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7368 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7369 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7370 | unsigned int mux_idx; |
| 7371 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7372 | int conns, mute, idx, item; |
| 7373 | |
| 7374 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7375 | ARRAY_SIZE(conn_list)); |
| 7376 | if (conns < 0) |
| 7377 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7378 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7379 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7380 | for (idx = 0; idx < conns; idx++) { |
| 7381 | /* if the current connection is the selected one, |
| 7382 | * unmute it as default - otherwise mute it |
| 7383 | */ |
| 7384 | mute = AMP_IN_MUTE(idx); |
| 7385 | for (item = 0; item < imux->num_items; item++) { |
| 7386 | if (imux->items[item].index == idx) { |
| 7387 | if (spec->cur_mux[c] == item) |
| 7388 | mute = AMP_IN_UNMUTE(idx); |
| 7389 | break; |
| 7390 | } |
| 7391 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7392 | /* check if we have a selector or mixer |
| 7393 | * we could check for the widget type instead, but |
| 7394 | * just check for Amp-In presence (in case of mixer |
| 7395 | * without amp-in there is something wrong, this |
| 7396 | * function shouldn't be used or capsrc nid is wrong) |
| 7397 | */ |
| 7398 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7399 | snd_hda_codec_write(codec, nid, 0, |
| 7400 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7401 | mute); |
| 7402 | else if (mute != AMP_IN_MUTE(idx)) |
| 7403 | snd_hda_codec_write(codec, nid, 0, |
| 7404 | AC_VERB_SET_CONNECT_SEL, |
| 7405 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7406 | } |
| 7407 | } |
| 7408 | } |
| 7409 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7410 | /* add mic boosts if needed */ |
| 7411 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7412 | { |
| 7413 | struct alc_spec *spec = codec->spec; |
| 7414 | int err; |
| 7415 | hda_nid_t nid; |
| 7416 | |
| 7417 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7418 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7419 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7420 | "Mic Boost", |
| 7421 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7422 | if (err < 0) |
| 7423 | return err; |
| 7424 | } |
| 7425 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7426 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7427 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7428 | "Front Mic Boost", |
| 7429 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7430 | if (err < 0) |
| 7431 | return err; |
| 7432 | } |
| 7433 | return 0; |
| 7434 | } |
| 7435 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7436 | /* almost identical with ALC880 parser... */ |
| 7437 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7438 | { |
| 7439 | struct alc_spec *spec = codec->spec; |
| 7440 | int err = alc880_parse_auto_config(codec); |
| 7441 | |
| 7442 | if (err < 0) |
| 7443 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7444 | else if (!err) |
| 7445 | return 0; /* no config found */ |
| 7446 | |
| 7447 | err = alc_auto_add_mic_boost(codec); |
| 7448 | if (err < 0) |
| 7449 | return err; |
| 7450 | |
| 7451 | /* hack - override the init verbs */ |
| 7452 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7453 | |
| 7454 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7455 | } |
| 7456 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7457 | /* additional initialization for auto-configuration model */ |
| 7458 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7459 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7460 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7461 | alc882_auto_init_multi_out(codec); |
| 7462 | alc882_auto_init_hp_out(codec); |
| 7463 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7464 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7465 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7466 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7467 | } |
| 7468 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7469 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7470 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7471 | static int patch_alc882(struct hda_codec *codec) |
| 7472 | { |
| 7473 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7474 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7475 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7476 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7477 | if (spec == NULL) |
| 7478 | return -ENOMEM; |
| 7479 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7480 | codec->spec = spec; |
| 7481 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7482 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7483 | alc882_models, |
| 7484 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7485 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7486 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7487 | /* Pick up systems that don't supply PCI SSID */ |
| 7488 | switch (codec->subsystem_id) { |
| 7489 | case 0x106b0c00: /* Mac Pro */ |
| 7490 | board_config = ALC885_MACPRO; |
| 7491 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7492 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7493 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7494 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7495 | board_config = ALC885_IMAC24; |
| 7496 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7497 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7498 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7499 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7500 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7501 | /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7502 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7503 | board_config = ALC885_MBP3; |
| 7504 | break; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7505 | case 0x106b3f00: /* Macbook 5,1 */ |
Takashi Iwai | 7442f9d | 2009-05-14 18:20:33 +0200 | [diff] [blame] | 7506 | case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense |
| 7507 | * seems not working, so apparently |
| 7508 | * no perfect solution yet |
| 7509 | */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7510 | board_config = ALC885_MB5; |
| 7511 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7512 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7513 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7514 | if (codec->revision_id == 0x100101 || |
| 7515 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7516 | alc_free(codec); |
| 7517 | return patch_alc883(codec); |
| 7518 | } |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7519 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 7520 | "trying auto-probe from BIOS...\n", |
| 7521 | codec->chip_name); |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7522 | board_config = ALC882_AUTO; |
| 7523 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7524 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7525 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7526 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7527 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7528 | if (board_config == ALC882_AUTO) { |
| 7529 | /* automatic parse from the BIOS config */ |
| 7530 | err = alc882_parse_auto_config(codec); |
| 7531 | if (err < 0) { |
| 7532 | alc_free(codec); |
| 7533 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7534 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7535 | printk(KERN_INFO |
| 7536 | "hda_codec: Cannot set up configuration " |
| 7537 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7538 | board_config = ALC882_3ST_DIG; |
| 7539 | } |
| 7540 | } |
| 7541 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7542 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7543 | if (err < 0) { |
| 7544 | alc_free(codec); |
| 7545 | return err; |
| 7546 | } |
| 7547 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7548 | if (board_config != ALC882_AUTO) |
| 7549 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7550 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7551 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7552 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7553 | /* FIXME: setup DAC5 */ |
| 7554 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7555 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7556 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7557 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7558 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7559 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7560 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7561 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7562 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7563 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7564 | /* get type */ |
| 7565 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7566 | if (wcap != AC_WID_AUD_IN) { |
| 7567 | spec->adc_nids = alc882_adc_nids_alt; |
| 7568 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7569 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7570 | } else { |
| 7571 | spec->adc_nids = alc882_adc_nids; |
| 7572 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7573 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7574 | } |
| 7575 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7576 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7577 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7578 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7579 | spec->vmaster_nid = 0x0c; |
| 7580 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7581 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7582 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7583 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7584 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7585 | if (!spec->loopback.amplist) |
| 7586 | spec->loopback.amplist = alc882_loopbacks; |
| 7587 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7588 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7589 | |
| 7590 | return 0; |
| 7591 | } |
| 7592 | |
| 7593 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7594 | * ALC883 support |
| 7595 | * |
| 7596 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7597 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7598 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7599 | * 6-channel independent captures. |
| 7600 | * |
| 7601 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7602 | * driver yet). |
| 7603 | */ |
| 7604 | #define ALC883_DIGOUT_NID 0x06 |
| 7605 | #define ALC883_DIGIN_NID 0x0a |
| 7606 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7607 | #define ALC1200_DIGOUT_NID 0x10 |
| 7608 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7609 | static hda_nid_t alc883_dac_nids[4] = { |
| 7610 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7611 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7612 | }; |
| 7613 | |
| 7614 | static hda_nid_t alc883_adc_nids[2] = { |
| 7615 | /* ADC1-2 */ |
| 7616 | 0x08, 0x09, |
| 7617 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7618 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7619 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7620 | /* ADC1 */ |
| 7621 | 0x08, |
| 7622 | }; |
| 7623 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7624 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7625 | /* ADC2-1 */ |
| 7626 | 0x09, 0x08 |
| 7627 | }; |
| 7628 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7629 | #define alc889_adc_nids alc880_adc_nids |
| 7630 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7631 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7632 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7633 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7634 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7635 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7636 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7637 | /* input MUX */ |
| 7638 | /* FIXME: should be a matrix-type input source selection */ |
| 7639 | |
| 7640 | static struct hda_input_mux alc883_capture_source = { |
| 7641 | .num_items = 4, |
| 7642 | .items = { |
| 7643 | { "Mic", 0x0 }, |
| 7644 | { "Front Mic", 0x1 }, |
| 7645 | { "Line", 0x2 }, |
| 7646 | { "CD", 0x4 }, |
| 7647 | }, |
| 7648 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7649 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7650 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7651 | .num_items = 4, |
| 7652 | .items = { |
| 7653 | { "Mic", 0x1 }, |
| 7654 | { "Front Mic", 0x0 }, |
| 7655 | { "Line", 0x2 }, |
| 7656 | { "CD", 0x4 }, |
| 7657 | }, |
| 7658 | }; |
| 7659 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7660 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7661 | .num_items = 2, |
| 7662 | .items = { |
| 7663 | { "Mic", 0x1 }, |
| 7664 | { "Line", 0x2 }, |
| 7665 | }, |
| 7666 | }; |
| 7667 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7668 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7669 | .num_items = 4, |
| 7670 | .items = { |
| 7671 | { "Mic", 0x0 }, |
| 7672 | { "iMic", 0x1 }, |
| 7673 | { "Line", 0x2 }, |
| 7674 | { "CD", 0x4 }, |
| 7675 | }, |
| 7676 | }; |
| 7677 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7678 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7679 | .num_items = 2, |
| 7680 | .items = { |
| 7681 | { "Mic", 0x0 }, |
| 7682 | { "Int Mic", 0x1 }, |
| 7683 | }, |
| 7684 | }; |
| 7685 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7686 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7687 | .num_items = 3, |
| 7688 | .items = { |
| 7689 | { "Mic", 0x0 }, |
| 7690 | { "Front Mic", 0x1 }, |
| 7691 | { "Line", 0x4 }, |
| 7692 | }, |
| 7693 | }; |
| 7694 | |
| 7695 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7696 | .num_items = 2, |
| 7697 | .items = { |
| 7698 | { "Mic", 0x0 }, |
| 7699 | { "Line", 0x2 }, |
| 7700 | }, |
| 7701 | }; |
| 7702 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7703 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7704 | .num_items = 2, |
| 7705 | .items = { |
| 7706 | { "Mic", 0x0 }, |
| 7707 | /* Front Mic (0x01) unused */ |
| 7708 | { "Line", 0x2 }, |
| 7709 | /* Line 2 (0x03) unused */ |
| 7710 | /* CD (0x04) unsused? */ |
| 7711 | }, |
| 7712 | }; |
| 7713 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7714 | /* |
| 7715 | * 2ch mode |
| 7716 | */ |
| 7717 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7718 | { 2, NULL } |
| 7719 | }; |
| 7720 | |
| 7721 | /* |
| 7722 | * 2ch mode |
| 7723 | */ |
| 7724 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7725 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7726 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7727 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7728 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7729 | { } /* end */ |
| 7730 | }; |
| 7731 | |
| 7732 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7733 | * 4ch mode |
| 7734 | */ |
| 7735 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7736 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7737 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7738 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7739 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7740 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7741 | { } /* end */ |
| 7742 | }; |
| 7743 | |
| 7744 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7745 | * 6ch mode |
| 7746 | */ |
| 7747 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7748 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7749 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7750 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7751 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7752 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7753 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7754 | { } /* end */ |
| 7755 | }; |
| 7756 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7757 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7758 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7759 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7760 | { 6, alc883_3ST_ch6_init }, |
| 7761 | }; |
| 7762 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7763 | |
| 7764 | /* |
| 7765 | * 2ch mode |
| 7766 | */ |
| 7767 | static struct hda_verb alc883_4ST_ch2_init[] = { |
Takashi Iwai | f03ecf5 | 2009-06-08 16:38:17 +0200 | [diff] [blame] | 7768 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7769 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7770 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7771 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7772 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7773 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7774 | { } /* end */ |
| 7775 | }; |
| 7776 | |
| 7777 | /* |
| 7778 | * 4ch mode |
| 7779 | */ |
| 7780 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7781 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7782 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7783 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7784 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7785 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7786 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7787 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7788 | { } /* end */ |
| 7789 | }; |
| 7790 | |
| 7791 | /* |
| 7792 | * 6ch mode |
| 7793 | */ |
| 7794 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7795 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7796 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7797 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7798 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7799 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7800 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7801 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7802 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7803 | { } /* end */ |
| 7804 | }; |
| 7805 | |
| 7806 | /* |
| 7807 | * 8ch mode |
| 7808 | */ |
| 7809 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7810 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7811 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7812 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7813 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7814 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7815 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7816 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7817 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7818 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7819 | { } /* end */ |
| 7820 | }; |
| 7821 | |
| 7822 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7823 | { 2, alc883_4ST_ch2_init }, |
| 7824 | { 4, alc883_4ST_ch4_init }, |
| 7825 | { 6, alc883_4ST_ch6_init }, |
| 7826 | { 8, alc883_4ST_ch8_init }, |
| 7827 | }; |
| 7828 | |
| 7829 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7830 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7831 | * 2ch mode |
| 7832 | */ |
| 7833 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7834 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7835 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7836 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7837 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7838 | { } /* end */ |
| 7839 | }; |
| 7840 | |
| 7841 | /* |
| 7842 | * 4ch mode |
| 7843 | */ |
| 7844 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7845 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7846 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7847 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7848 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7849 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7850 | { } /* end */ |
| 7851 | }; |
| 7852 | |
| 7853 | /* |
| 7854 | * 6ch mode |
| 7855 | */ |
| 7856 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7857 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7858 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7859 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7860 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7861 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7862 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7863 | { } /* end */ |
| 7864 | }; |
| 7865 | |
| 7866 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7867 | { 2, alc883_3ST_ch2_intel_init }, |
| 7868 | { 4, alc883_3ST_ch4_intel_init }, |
| 7869 | { 6, alc883_3ST_ch6_intel_init }, |
| 7870 | }; |
| 7871 | |
| 7872 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7873 | * 6ch mode |
| 7874 | */ |
| 7875 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7876 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7877 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7878 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7879 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7880 | { } /* end */ |
| 7881 | }; |
| 7882 | |
| 7883 | /* |
| 7884 | * 8ch mode |
| 7885 | */ |
| 7886 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7887 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7888 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7889 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7890 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7891 | { } /* end */ |
| 7892 | }; |
| 7893 | |
| 7894 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7895 | { 6, alc883_sixstack_ch6_init }, |
| 7896 | { 8, alc883_sixstack_ch8_init }, |
| 7897 | }; |
| 7898 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7899 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7900 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7901 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7902 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7903 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7904 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7905 | { } /* end */ |
| 7906 | }; |
| 7907 | |
| 7908 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7909 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7910 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7911 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7912 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7913 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7914 | { } /* end */ |
| 7915 | }; |
| 7916 | |
| 7917 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7918 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7919 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7920 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7921 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7922 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7923 | { } /* end */ |
| 7924 | }; |
| 7925 | |
| 7926 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7927 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7928 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7929 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7930 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7931 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7932 | { } /* end */ |
| 7933 | }; |
| 7934 | |
| 7935 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7936 | { 2, alc889A_mb31_ch2_init }, |
| 7937 | { 4, alc889A_mb31_ch4_init }, |
| 7938 | { 5, alc889A_mb31_ch5_init }, |
| 7939 | { 6, alc889A_mb31_ch6_init }, |
| 7940 | }; |
| 7941 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7942 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7943 | /* eanable EAPD on medion laptop */ |
| 7944 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7945 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7946 | { } |
| 7947 | }; |
| 7948 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7949 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7950 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7951 | */ |
| 7952 | |
| 7953 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7954 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7955 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7956 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7957 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7958 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7959 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7960 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7961 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7962 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7963 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7964 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7966 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7968 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7970 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7971 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7972 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7973 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7974 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7975 | { } /* end */ |
| 7976 | }; |
| 7977 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7978 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7981 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7982 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7983 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7984 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7985 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7986 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7987 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7988 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7989 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7990 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7991 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7992 | { } /* end */ |
| 7993 | }; |
| 7994 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7995 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7996 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7997 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7998 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7999 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8001 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8003 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8004 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8005 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8006 | { } /* end */ |
| 8007 | }; |
| 8008 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8009 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8010 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8011 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8012 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8013 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8014 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8015 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8016 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8017 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8018 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8019 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8020 | { } /* end */ |
| 8021 | }; |
| 8022 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8023 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8024 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8025 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8026 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8027 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8028 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8029 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8030 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8031 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8032 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8033 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8034 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8035 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8036 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8037 | { } /* end */ |
| 8038 | }; |
| 8039 | |
| 8040 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8041 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8042 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8043 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8044 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8045 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8046 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8047 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8048 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8049 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8050 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8051 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8052 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8053 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8054 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8055 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8056 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8057 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8058 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8059 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8060 | { } /* end */ |
| 8061 | }; |
| 8062 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8063 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8065 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8066 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8067 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8068 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8069 | HDA_OUTPUT), |
| 8070 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8071 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8072 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8073 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8074 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8075 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8076 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8077 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8078 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8079 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8081 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8082 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8083 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8084 | { } /* end */ |
| 8085 | }; |
| 8086 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8087 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8088 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8089 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8090 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8091 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8092 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8093 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8094 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8095 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8096 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8097 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8098 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8099 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8100 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8101 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8102 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8103 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8104 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8105 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8106 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8107 | { } /* end */ |
| 8108 | }; |
| 8109 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8110 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8111 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8112 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8113 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8114 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8115 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8116 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8117 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8118 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8119 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8120 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8121 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8122 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8123 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8125 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8127 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8128 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8129 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8130 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8131 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8132 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8133 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8134 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8135 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8139 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8140 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8141 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8142 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8143 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8144 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8145 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8146 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8147 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8148 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8149 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8150 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8151 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8152 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8153 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8154 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8155 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8156 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8157 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8158 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8159 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8160 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8161 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8162 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8163 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8164 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8165 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8166 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8167 | { } /* end */ |
| 8168 | }; |
| 8169 | |
| 8170 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8171 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8172 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8173 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8174 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8175 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8176 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8177 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8178 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8179 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8180 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8181 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8182 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8183 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8184 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8185 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8186 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8187 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8188 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8189 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8190 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8192 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8193 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8194 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8195 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8196 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8197 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8198 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8199 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8200 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8201 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8202 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8203 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8204 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8205 | { } /* end */ |
| 8206 | }; |
| 8207 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8208 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8209 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8210 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8211 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8212 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8213 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8214 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8215 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8216 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8217 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8218 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8219 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8220 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8221 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8222 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8223 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8224 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8225 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8226 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8227 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8228 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8229 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8230 | { } /* end */ |
| 8231 | }; |
| 8232 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8233 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8234 | /* Output mixers */ |
| 8235 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8236 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8237 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8238 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8239 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8240 | HDA_OUTPUT), |
| 8241 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8242 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8243 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8244 | /* Output switches */ |
| 8245 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8246 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8247 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8248 | /* Boost mixers */ |
| 8249 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8250 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8251 | /* Input mixers */ |
| 8252 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8254 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8255 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8256 | { } /* end */ |
| 8257 | }; |
| 8258 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8259 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8260 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8261 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8262 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8264 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8265 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8266 | { } /* end */ |
| 8267 | }; |
| 8268 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8269 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8270 | .ops = &snd_hda_bind_vol, |
| 8271 | .values = { |
| 8272 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8273 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8274 | 0 |
| 8275 | }, |
| 8276 | }; |
| 8277 | |
| 8278 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8279 | .ops = &snd_hda_bind_sw, |
| 8280 | .values = { |
| 8281 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8282 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8283 | 0 |
| 8284 | }, |
| 8285 | }; |
| 8286 | |
| 8287 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8288 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8289 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8290 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8291 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8292 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8293 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8294 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8295 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8296 | { } /* end */ |
| 8297 | }; |
| 8298 | |
| 8299 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8300 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8301 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8302 | { |
| 8303 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8304 | /* .name = "Capture Source", */ |
| 8305 | .name = "Input Source", |
| 8306 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8307 | .info = alc_mux_enum_info, |
| 8308 | .get = alc_mux_enum_get, |
| 8309 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8310 | }, |
| 8311 | { } /* end */ |
| 8312 | }; |
| 8313 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8314 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8315 | { |
| 8316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8317 | .name = "Channel Mode", |
| 8318 | .info = alc_ch_mode_info, |
| 8319 | .get = alc_ch_mode_get, |
| 8320 | .put = alc_ch_mode_put, |
| 8321 | }, |
| 8322 | { } /* end */ |
| 8323 | }; |
| 8324 | |
| 8325 | static struct hda_verb alc883_init_verbs[] = { |
| 8326 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8327 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8328 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8329 | /* ADC2: mute amp left and right */ |
| 8330 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8331 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8332 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8336 | /* Rear mixer */ |
| 8337 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8338 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8339 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8340 | /* CLFE mixer */ |
| 8341 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8342 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8343 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8344 | /* Side mixer */ |
| 8345 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8346 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8347 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8348 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8349 | /* mute analog input loopbacks */ |
| 8350 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8351 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8352 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8353 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8354 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8355 | |
| 8356 | /* Front Pin: output 0 (0x0c) */ |
| 8357 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8358 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8359 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8360 | /* Rear Pin: output 1 (0x0d) */ |
| 8361 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8362 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8363 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8364 | /* CLFE Pin: output 2 (0x0e) */ |
| 8365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8366 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8367 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8368 | /* Side Pin: output 3 (0x0f) */ |
| 8369 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8370 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8371 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8372 | /* Mic (rear) pin: input vref at 80% */ |
| 8373 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8374 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8375 | /* Front Mic pin: input vref at 80% */ |
| 8376 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8377 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8378 | /* Line In pin: input */ |
| 8379 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8380 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8381 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8382 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8383 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8384 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8385 | /* CD pin widget for input */ |
| 8386 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8387 | |
| 8388 | /* FIXME: use matrix-type input source selection */ |
| 8389 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8390 | /* Input mixer2 */ |
| 8391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8394 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8395 | /* Input mixer3 */ |
| 8396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8400 | { } |
| 8401 | }; |
| 8402 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8403 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8404 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8405 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8406 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8407 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8408 | spec->autocfg.hp_pins[0] = 0x15; |
| 8409 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8410 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8411 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8412 | } |
| 8413 | |
| 8414 | /* auto-toggle front mic */ |
| 8415 | /* |
| 8416 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8417 | { |
| 8418 | unsigned int present; |
| 8419 | unsigned char bits; |
| 8420 | |
| 8421 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8422 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8423 | bits = present ? HDA_AMP_MUTE : 0; |
| 8424 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8425 | } |
| 8426 | */ |
| 8427 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8428 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8429 | /* HP */ |
| 8430 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8431 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8432 | /* Subwoofer */ |
| 8433 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8434 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8435 | |
| 8436 | /* enable unsolicited event */ |
| 8437 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8438 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8439 | |
| 8440 | { } /* end */ |
| 8441 | }; |
| 8442 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8443 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8444 | /* HP */ |
| 8445 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8446 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8447 | /* Int speaker */ |
| 8448 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8449 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8450 | |
| 8451 | /* enable unsolicited event */ |
| 8452 | {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] | 8453 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8454 | |
| 8455 | { } /* end */ |
| 8456 | }; |
| 8457 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8458 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8459 | /* HP */ |
| 8460 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8461 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8462 | /* Subwoofer */ |
| 8463 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8465 | |
| 8466 | /* enable unsolicited event */ |
| 8467 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8468 | |
| 8469 | { } /* end */ |
| 8470 | }; |
| 8471 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8472 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8474 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8475 | |
| 8476 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8477 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8478 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8479 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8480 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8481 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8482 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8483 | /* Connect Mic jack to CLFE */ |
| 8484 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8485 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8486 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8487 | /* Connect Line-in jack to Surround */ |
| 8488 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8489 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8490 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8491 | /* Connect HP out jack to Front */ |
| 8492 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8493 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8494 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8495 | |
| 8496 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8497 | |
| 8498 | { } /* end */ |
| 8499 | }; |
| 8500 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8501 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8502 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8503 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8504 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8505 | { } /* end */ |
| 8506 | }; |
| 8507 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8508 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8509 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8510 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8511 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8512 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8513 | { } /* end */ |
| 8514 | }; |
| 8515 | |
| 8516 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8519 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8520 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8521 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8522 | { } /* end */ |
| 8523 | }; |
| 8524 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8525 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8528 | |
| 8529 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8530 | |
| 8531 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8532 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8533 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8534 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8535 | { } /* end */ |
| 8536 | }; |
| 8537 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8538 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8539 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8541 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8542 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8543 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8544 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8545 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8546 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8547 | { } /* end */ |
| 8548 | }; |
| 8549 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8550 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8551 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8552 | { } |
| 8553 | }; |
| 8554 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8555 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8556 | /* HP */ |
| 8557 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8558 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8559 | |
| 8560 | /* enable unsolicited event */ |
| 8561 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8562 | |
| 8563 | { } /* end */ |
| 8564 | }; |
| 8565 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8566 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8567 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8568 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8569 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8570 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8571 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8572 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8573 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8574 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8575 | } |
| 8576 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8577 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8578 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8579 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8580 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8581 | {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] | 8582 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8583 | }; |
| 8584 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8585 | /* |
| 8586 | * 2ch mode |
| 8587 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8588 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8589 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8590 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8591 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8592 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8593 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8594 | }; |
| 8595 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8596 | /* |
| 8597 | * 4ch mode |
| 8598 | */ |
| 8599 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8600 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8601 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8602 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8603 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8604 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8605 | { } /* end */ |
| 8606 | }; |
| 8607 | |
| 8608 | /* |
| 8609 | * 6ch mode |
| 8610 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8611 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8612 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8613 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8614 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8615 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8616 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8617 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8618 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8619 | }; |
| 8620 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8621 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8622 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8623 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8624 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8625 | }; |
| 8626 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8627 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8628 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8629 | { |
| 8630 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8631 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8632 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8633 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8634 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8635 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8636 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8637 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8638 | } |
| 8639 | |
| 8640 | /* toggle RCA according to the front-jack state */ |
| 8641 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8642 | { |
| 8643 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8644 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8645 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8646 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8647 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8648 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8649 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8650 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8651 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8652 | unsigned int res) |
| 8653 | { |
| 8654 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8655 | alc888_lenovo_ms7195_front_automute(codec); |
| 8656 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8657 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8658 | } |
| 8659 | |
| 8660 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8661 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8662 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8663 | |
| 8664 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8665 | |
| 8666 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8667 | { } /* end */ |
| 8668 | }; |
| 8669 | |
| 8670 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8671 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8672 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8673 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8674 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8675 | spec->autocfg.hp_pins[0] = 0x14; |
| 8676 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8677 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8678 | } |
| 8679 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8680 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8681 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8682 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8683 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8684 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8685 | { |
| 8686 | unsigned int present; |
| 8687 | |
| 8688 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8689 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8690 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8691 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8692 | } |
| 8693 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8694 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8695 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8696 | struct alc_spec *spec = codec->spec; |
| 8697 | |
| 8698 | spec->autocfg.hp_pins[0] = 0x15; |
| 8699 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8700 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8701 | alc883_clevo_m720_mic_automute(codec); |
| 8702 | } |
| 8703 | |
| 8704 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8705 | unsigned int res) |
| 8706 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8707 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8708 | case ALC880_MIC_EVENT: |
| 8709 | alc883_clevo_m720_mic_automute(codec); |
| 8710 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8711 | default: |
| 8712 | alc_automute_amp_unsol_event(codec, res); |
| 8713 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8714 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8715 | } |
| 8716 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8717 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8718 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8719 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8720 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8721 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8722 | spec->autocfg.hp_pins[0] = 0x14; |
| 8723 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8724 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8725 | } |
| 8726 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8727 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8728 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8729 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8730 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8731 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8732 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8733 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8734 | } |
| 8735 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8736 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8737 | { |
| 8738 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8739 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8740 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8741 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8742 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8743 | bits = present ? HDA_AMP_MUTE : 0; |
| 8744 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8745 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8746 | } |
| 8747 | |
| 8748 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8749 | { |
| 8750 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8751 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8752 | |
| 8753 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8754 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8755 | bits = present ? HDA_AMP_MUTE : 0; |
| 8756 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8757 | HDA_AMP_MUTE, bits); |
| 8758 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8759 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8760 | } |
| 8761 | |
| 8762 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8763 | unsigned int res) |
| 8764 | { |
| 8765 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8766 | alc883_lenovo_101e_all_automute(codec); |
| 8767 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8768 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8769 | } |
| 8770 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8771 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8772 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8773 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8774 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8775 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8776 | spec->autocfg.hp_pins[0] = 0x14; |
| 8777 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8778 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8779 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8780 | } |
| 8781 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8782 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8783 | /* HP Pin: output 0 (0x0c) */ |
| 8784 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8785 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8786 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8787 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8789 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8790 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8791 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8792 | /* eanable EAPD on medion laptop */ |
| 8793 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8794 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8795 | /* enable unsolicited event */ |
| 8796 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8797 | { } |
| 8798 | }; |
| 8799 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8800 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8801 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8802 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8803 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8804 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8805 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8806 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8807 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8808 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8809 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8810 | } |
| 8811 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8812 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8813 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8814 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8815 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8816 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8817 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8818 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8819 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8820 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8821 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8822 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8823 | } |
| 8824 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8825 | static void alc883_vaiott_init_hook(struct hda_codec *codec) |
| 8826 | { |
| 8827 | struct alc_spec *spec = codec->spec; |
| 8828 | |
| 8829 | spec->autocfg.hp_pins[0] = 0x15; |
| 8830 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8831 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8832 | alc_automute_amp(codec); |
| 8833 | } |
| 8834 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8835 | /* |
| 8836 | * generic initialization of ADC, input mixers and output mixers |
| 8837 | */ |
| 8838 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8839 | /* |
| 8840 | * Unmute ADC0-2 and set the default input to mic-in |
| 8841 | */ |
| 8842 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8843 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8844 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8845 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8846 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8847 | /* 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] | 8848 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8849 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8850 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8851 | */ |
| 8852 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8853 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8854 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8856 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8857 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8858 | |
| 8859 | /* |
| 8860 | * Set up output mixers (0x0c - 0x0f) |
| 8861 | */ |
| 8862 | /* set vol=0 to output mixers */ |
| 8863 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8864 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8865 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8866 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8867 | /* set up input amps for analog loopback */ |
| 8868 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8869 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8870 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8871 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8872 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8873 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8874 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8875 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8876 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8877 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8878 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8879 | |
| 8880 | /* FIXME: use matrix-type input source selection */ |
| 8881 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8882 | /* Input mixer1 */ |
| 8883 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8884 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8885 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8886 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8887 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8888 | /* Input mixer2 */ |
| 8889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8890 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8892 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8893 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8894 | |
| 8895 | { } |
| 8896 | }; |
| 8897 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8898 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8899 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8900 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8901 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8902 | /* enable unsolicited event */ |
| 8903 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8904 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8905 | { } /* end */ |
| 8906 | }; |
| 8907 | |
| 8908 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8909 | { |
| 8910 | unsigned int present; |
| 8911 | |
| 8912 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8913 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8914 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8915 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8916 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8917 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8918 | } |
| 8919 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8920 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8921 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8922 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8923 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8924 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8925 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8926 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8927 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8928 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8929 | } |
| 8930 | |
| 8931 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8932 | unsigned int res) |
| 8933 | { |
| 8934 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8935 | case ALC880_MIC_EVENT: |
| 8936 | alc883_nb_mic_automute(codec); |
| 8937 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8938 | default: |
| 8939 | alc_sku_unsol_event(codec, res); |
| 8940 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8941 | } |
| 8942 | } |
| 8943 | |
| 8944 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8945 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8946 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8947 | alc883_nb_mic_automute(codec); |
| 8948 | } |
| 8949 | |
| 8950 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8951 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8952 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8953 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8954 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8956 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8957 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8958 | /* enable unsolicited event */ |
| 8959 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8960 | { } /* end */ |
| 8961 | }; |
| 8962 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8963 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8964 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8965 | struct alc_spec *spec = codec->spec; |
| 8966 | |
| 8967 | spec->autocfg.hp_pins[0] = 0x14; |
| 8968 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8969 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8970 | } |
| 8971 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8972 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8973 | /* Init rear pin (used as headphone output) */ |
| 8974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8975 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8976 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8977 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8978 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8979 | /* Init line 2 pin (used as headphone out by default) */ |
| 8980 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8981 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8982 | { } /* end */ |
| 8983 | }; |
| 8984 | |
| 8985 | /* Mute speakers according to the headphone jack state */ |
| 8986 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8987 | { |
| 8988 | unsigned int present; |
| 8989 | |
| 8990 | /* Mute only in 2ch or 4ch mode */ |
| 8991 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8992 | == 0x00) { |
| 8993 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8994 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8995 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8996 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8997 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8998 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8999 | } |
| 9000 | } |
| 9001 | |
| 9002 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9003 | { |
| 9004 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9005 | alc889A_mb31_automute(codec); |
| 9006 | } |
| 9007 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9008 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9009 | #define alc883_loopbacks alc880_loopbacks |
| 9010 | #endif |
| 9011 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9012 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9013 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 9014 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9015 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9016 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 9017 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 9018 | |
| 9019 | /* |
| 9020 | * configuration and preset |
| 9021 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9022 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 9023 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 9024 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9025 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 9026 | [ALC883_6ST_DIG] = "6stack-dig", |
| 9027 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9028 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9029 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9030 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9031 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9032 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9033 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9034 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9035 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9036 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9037 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9038 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9039 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9040 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9041 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9042 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9043 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9044 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9045 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9046 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9047 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9048 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9049 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9050 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9051 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9052 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9053 | [ALC883_AUTO] = "auto", |
| 9054 | }; |
| 9055 | |
| 9056 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 9057 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9058 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9059 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9060 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9061 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9062 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9063 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9064 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9065 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9066 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 9067 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9068 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9069 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9070 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9071 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 9072 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 9073 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9074 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 9075 | ALC888_ACER_ASPIRE_4930G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9076 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9077 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9078 | /* default Acer -- disabled as it causes more problems. |
| 9079 | * model=auto should work fine now |
| 9080 | */ |
| 9081 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9082 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9083 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9084 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9085 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9086 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9087 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9088 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9089 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9090 | 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] | 9091 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9092 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9093 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9094 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9095 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9096 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9097 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9098 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9099 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9100 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 9101 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9102 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9103 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9104 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 9105 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9106 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9107 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9108 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9109 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9110 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9111 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9112 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9113 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 9114 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9115 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9116 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9117 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9118 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9119 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9120 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9121 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9122 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9123 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9124 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9125 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9126 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9127 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9128 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9129 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9130 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9131 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9132 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9133 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9134 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9135 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9136 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9137 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9138 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9139 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9140 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9141 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9142 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9143 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9144 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9145 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9146 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9147 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9148 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 9149 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9150 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9151 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9152 | {} |
| 9153 | }; |
| 9154 | |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9155 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9156 | ALC1200_DIGOUT_NID, 0, |
| 9157 | }; |
| 9158 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9159 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9160 | ALC883_DIGOUT_NID, 0, |
| 9161 | }; |
| 9162 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9163 | static struct alc_config_preset alc883_presets[] = { |
| 9164 | [ALC883_3ST_2ch_DIG] = { |
| 9165 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9166 | .init_verbs = { alc883_init_verbs }, |
| 9167 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9168 | .dac_nids = alc883_dac_nids, |
| 9169 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9170 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9171 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9172 | .channel_mode = alc883_3ST_2ch_modes, |
| 9173 | .input_mux = &alc883_capture_source, |
| 9174 | }, |
| 9175 | [ALC883_3ST_6ch_DIG] = { |
| 9176 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9177 | .init_verbs = { alc883_init_verbs }, |
| 9178 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9179 | .dac_nids = alc883_dac_nids, |
| 9180 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9181 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9182 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9183 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9184 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9185 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9186 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9187 | [ALC883_3ST_6ch] = { |
| 9188 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9189 | .init_verbs = { alc883_init_verbs }, |
| 9190 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9191 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9192 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9193 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9194 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9195 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9196 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9197 | [ALC883_3ST_6ch_INTEL] = { |
| 9198 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9199 | .init_verbs = { alc883_init_verbs }, |
| 9200 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9201 | .dac_nids = alc883_dac_nids, |
| 9202 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9203 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9204 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9205 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9206 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9207 | .need_dac_fix = 1, |
| 9208 | .input_mux = &alc883_3stack_6ch_intel, |
| 9209 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9210 | [ALC883_6ST_DIG] = { |
| 9211 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9212 | .init_verbs = { alc883_init_verbs }, |
| 9213 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9214 | .dac_nids = alc883_dac_nids, |
| 9215 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9216 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9217 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9218 | .channel_mode = alc883_sixstack_modes, |
| 9219 | .input_mux = &alc883_capture_source, |
| 9220 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9221 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9222 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
| 9223 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9224 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9225 | .dac_nids = alc883_dac_nids, |
| 9226 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9227 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9228 | .channel_mode = alc883_3ST_6ch_modes, |
| 9229 | .need_dac_fix = 1, |
| 9230 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9231 | .unsol_event = alc883_targa_unsol_event, |
| 9232 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9233 | }, |
| 9234 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9235 | .mixers = { alc883_targa_2ch_mixer}, |
| 9236 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9237 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9238 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9239 | .adc_nids = alc883_adc_nids_alt, |
| 9240 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9241 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9242 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9243 | .channel_mode = alc883_3ST_2ch_modes, |
| 9244 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9245 | .unsol_event = alc883_targa_unsol_event, |
| 9246 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9247 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9248 | [ALC883_TARGA_8ch_DIG] = { |
| 9249 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9250 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9251 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9252 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9253 | .dac_nids = alc883_dac_nids, |
| 9254 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9255 | .adc_nids = alc883_adc_nids_rev, |
| 9256 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9257 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9258 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9259 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9260 | .channel_mode = alc883_4ST_8ch_modes, |
| 9261 | .need_dac_fix = 1, |
| 9262 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9263 | .unsol_event = alc883_targa_unsol_event, |
| 9264 | .init_hook = alc883_targa_init_hook, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9265 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9266 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9267 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9268 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9269 | * and the headphone jack. Turn this on and rely on the |
| 9270 | * standard mute methods whenever the user wants to turn |
| 9271 | * these outputs off. |
| 9272 | */ |
| 9273 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9274 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9275 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9276 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9277 | .channel_mode = alc883_3ST_2ch_modes, |
| 9278 | .input_mux = &alc883_capture_source, |
| 9279 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9280 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9281 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9282 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9283 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9284 | .dac_nids = alc883_dac_nids, |
| 9285 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9286 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9287 | .channel_mode = alc883_3ST_2ch_modes, |
| 9288 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9289 | .unsol_event = alc_automute_amp_unsol_event, |
| 9290 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9291 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9292 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9293 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9294 | alc883_chmode_mixer }, |
| 9295 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9296 | alc888_acer_aspire_4930g_verbs }, |
| 9297 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9298 | .dac_nids = alc883_dac_nids, |
| 9299 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9300 | .adc_nids = alc883_adc_nids_rev, |
| 9301 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9302 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9303 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9304 | .channel_mode = alc883_3ST_6ch_modes, |
| 9305 | .need_dac_fix = 1, |
| 9306 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9307 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9308 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9309 | .unsol_event = alc_automute_amp_unsol_event, |
| 9310 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9311 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9312 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9313 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9314 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9315 | alc888_acer_aspire_6530g_verbs }, |
| 9316 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9317 | .dac_nids = alc883_dac_nids, |
| 9318 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9319 | .adc_nids = alc883_adc_nids_rev, |
| 9320 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9321 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9322 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9323 | .channel_mode = alc883_3ST_2ch_modes, |
| 9324 | .num_mux_defs = |
| 9325 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9326 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9327 | .unsol_event = alc_automute_amp_unsol_event, |
| 9328 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
| 9329 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9330 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9331 | .mixers = { alc888_base_mixer, |
| 9332 | alc883_chmode_mixer }, |
| 9333 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9334 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9335 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9336 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9337 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9338 | .adc_nids = alc889_adc_nids, |
| 9339 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9340 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9341 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9342 | .channel_mode = alc883_3ST_6ch_modes, |
| 9343 | .need_dac_fix = 1, |
| 9344 | .const_channel_count = 6, |
| 9345 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9346 | ARRAY_SIZE(alc889_capture_sources), |
| 9347 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9348 | .unsol_event = alc_automute_amp_unsol_event, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9349 | .init_hook = alc889_acer_aspire_8930g_init_hook, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9350 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9351 | [ALC883_MEDION] = { |
| 9352 | .mixers = { alc883_fivestack_mixer, |
| 9353 | alc883_chmode_mixer }, |
| 9354 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9355 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9356 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9357 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9358 | .adc_nids = alc883_adc_nids_alt, |
| 9359 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9360 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9361 | .channel_mode = alc883_sixstack_modes, |
| 9362 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9363 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9364 | [ALC883_MEDION_MD2] = { |
| 9365 | .mixers = { alc883_medion_md2_mixer}, |
| 9366 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9367 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9368 | .dac_nids = alc883_dac_nids, |
| 9369 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9370 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9371 | .channel_mode = alc883_3ST_2ch_modes, |
| 9372 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9373 | .unsol_event = alc_automute_amp_unsol_event, |
| 9374 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9375 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9376 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9377 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9378 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9379 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9380 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9381 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9382 | .channel_mode = alc883_3ST_2ch_modes, |
| 9383 | .input_mux = &alc883_capture_source, |
| 9384 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9385 | [ALC883_CLEVO_M720] = { |
| 9386 | .mixers = { alc883_clevo_m720_mixer }, |
| 9387 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9388 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9389 | .dac_nids = alc883_dac_nids, |
| 9390 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9391 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9392 | .channel_mode = alc883_3ST_2ch_modes, |
| 9393 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9394 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9395 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9396 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9397 | [ALC883_LENOVO_101E_2ch] = { |
| 9398 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9399 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9400 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9401 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9402 | .adc_nids = alc883_adc_nids_alt, |
| 9403 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9404 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9405 | .channel_mode = alc883_3ST_2ch_modes, |
| 9406 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9407 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9408 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9409 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9410 | [ALC883_LENOVO_NB0763] = { |
| 9411 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9412 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9413 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9414 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9415 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9416 | .channel_mode = alc883_3ST_2ch_modes, |
| 9417 | .need_dac_fix = 1, |
| 9418 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9419 | .unsol_event = alc_automute_amp_unsol_event, |
| 9420 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9421 | }, |
| 9422 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9423 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9424 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9425 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9426 | .dac_nids = alc883_dac_nids, |
| 9427 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9428 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9429 | .channel_mode = alc883_3ST_6ch_modes, |
| 9430 | .need_dac_fix = 1, |
| 9431 | .input_mux = &alc883_capture_source, |
| 9432 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9433 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9434 | }, |
| 9435 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9436 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9437 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9438 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9439 | .dac_nids = alc883_dac_nids, |
| 9440 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9441 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9442 | .channel_mode = alc883_3ST_2ch_modes, |
| 9443 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9444 | .unsol_event = alc_automute_amp_unsol_event, |
| 9445 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9446 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9447 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9448 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9449 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9450 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9451 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9452 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9453 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9454 | .need_dac_fix = 1, |
| 9455 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9456 | .unsol_event = alc_automute_amp_unsol_event, |
| 9457 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9458 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9459 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9460 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9461 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9462 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9463 | .dac_nids = alc883_dac_nids, |
| 9464 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9465 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9466 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9467 | .channel_mode = alc883_sixstack_modes, |
| 9468 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9469 | .unsol_event = alc_automute_amp_unsol_event, |
| 9470 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9471 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9472 | [ALC883_MITAC] = { |
| 9473 | .mixers = { alc883_mitac_mixer }, |
| 9474 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9475 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9476 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9477 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9478 | .channel_mode = alc883_3ST_2ch_modes, |
| 9479 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9480 | .unsol_event = alc_automute_amp_unsol_event, |
| 9481 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9482 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9483 | [ALC883_FUJITSU_PI2515] = { |
| 9484 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9485 | .init_verbs = { alc883_init_verbs, |
| 9486 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9487 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9488 | .dac_nids = alc883_dac_nids, |
| 9489 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9490 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9491 | .channel_mode = alc883_3ST_2ch_modes, |
| 9492 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9493 | .unsol_event = alc_automute_amp_unsol_event, |
| 9494 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9495 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9496 | [ALC888_FUJITSU_XA3530] = { |
| 9497 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9498 | .init_verbs = { alc883_init_verbs, |
| 9499 | alc888_fujitsu_xa3530_verbs }, |
| 9500 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9501 | .dac_nids = alc883_dac_nids, |
| 9502 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9503 | .adc_nids = alc883_adc_nids_rev, |
| 9504 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9505 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9506 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9507 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9508 | .num_mux_defs = |
| 9509 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9510 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9511 | .unsol_event = alc_automute_amp_unsol_event, |
| 9512 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9513 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9514 | [ALC888_LENOVO_SKY] = { |
| 9515 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9516 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9517 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9518 | .dac_nids = alc883_dac_nids, |
| 9519 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9520 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9521 | .channel_mode = alc883_sixstack_modes, |
| 9522 | .need_dac_fix = 1, |
| 9523 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9524 | .unsol_event = alc_automute_amp_unsol_event, |
| 9525 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9526 | }, |
| 9527 | [ALC888_ASUS_M90V] = { |
| 9528 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9529 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9530 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9531 | .dac_nids = alc883_dac_nids, |
| 9532 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9533 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9534 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9535 | .channel_mode = alc883_3ST_6ch_modes, |
| 9536 | .need_dac_fix = 1, |
| 9537 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9538 | .unsol_event = alc883_mode2_unsol_event, |
| 9539 | .init_hook = alc883_mode2_inithook, |
| 9540 | }, |
| 9541 | [ALC888_ASUS_EEE1601] = { |
| 9542 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9543 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9544 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9545 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9546 | .dac_nids = alc883_dac_nids, |
| 9547 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9548 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9549 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9550 | .channel_mode = alc883_3ST_2ch_modes, |
| 9551 | .need_dac_fix = 1, |
| 9552 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9553 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9554 | .init_hook = alc883_eee1601_inithook, |
| 9555 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9556 | [ALC1200_ASUS_P5Q] = { |
| 9557 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9558 | .init_verbs = { alc883_init_verbs }, |
| 9559 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9560 | .dac_nids = alc883_dac_nids, |
| 9561 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9562 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9563 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9564 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9565 | .channel_mode = alc883_sixstack_modes, |
| 9566 | .input_mux = &alc883_capture_source, |
| 9567 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9568 | [ALC889A_MB31] = { |
| 9569 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9570 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9571 | alc880_gpio1_init_verbs }, |
| 9572 | .adc_nids = alc883_adc_nids, |
| 9573 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9574 | .dac_nids = alc883_dac_nids, |
| 9575 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9576 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9577 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9578 | .input_mux = &alc889A_mb31_capture_source, |
| 9579 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9580 | .unsol_event = alc889A_mb31_unsol_event, |
| 9581 | .init_hook = alc889A_mb31_automute, |
| 9582 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9583 | [ALC883_SONY_VAIO_TT] = { |
| 9584 | .mixers = { alc883_vaiott_mixer }, |
| 9585 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9586 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9587 | .dac_nids = alc883_dac_nids, |
| 9588 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9589 | .channel_mode = alc883_3ST_2ch_modes, |
| 9590 | .input_mux = &alc883_capture_source, |
| 9591 | .unsol_event = alc_automute_amp_unsol_event, |
| 9592 | .init_hook = alc883_vaiott_init_hook, |
| 9593 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9594 | }; |
| 9595 | |
| 9596 | |
| 9597 | /* |
| 9598 | * BIOS auto configuration |
| 9599 | */ |
| 9600 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9601 | hda_nid_t nid, int pin_type, |
| 9602 | int dac_idx) |
| 9603 | { |
| 9604 | /* set as output */ |
| 9605 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9606 | int idx; |
| 9607 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9608 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9609 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9610 | idx = 4; |
| 9611 | else |
| 9612 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9613 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9614 | |
| 9615 | } |
| 9616 | |
| 9617 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9618 | { |
| 9619 | struct alc_spec *spec = codec->spec; |
| 9620 | int i; |
| 9621 | |
| 9622 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9623 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9624 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9625 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9626 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9627 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9628 | } |
| 9629 | } |
| 9630 | |
| 9631 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9632 | { |
| 9633 | struct alc_spec *spec = codec->spec; |
| 9634 | hda_nid_t pin; |
| 9635 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9636 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9637 | if (pin) /* connect to front */ |
| 9638 | /* use dac 0 */ |
| 9639 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9640 | pin = spec->autocfg.speaker_pins[0]; |
| 9641 | if (pin) |
| 9642 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9643 | } |
| 9644 | |
| 9645 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9646 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9647 | |
| 9648 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9649 | { |
| 9650 | struct alc_spec *spec = codec->spec; |
| 9651 | int i; |
| 9652 | |
| 9653 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9654 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9655 | if (alc883_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 9656 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 9657 | if (nid != ALC883_PIN_CD_NID && |
| 9658 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9659 | snd_hda_codec_write(codec, nid, 0, |
| 9660 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9661 | AMP_OUT_MUTE); |
| 9662 | } |
| 9663 | } |
| 9664 | } |
| 9665 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9666 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9667 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9668 | /* almost identical with ALC880 parser... */ |
| 9669 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9670 | { |
| 9671 | struct alc_spec *spec = codec->spec; |
| 9672 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9673 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9674 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9675 | |
| 9676 | if (err < 0) |
| 9677 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9678 | else if (!err) |
| 9679 | return 0; /* no config found */ |
| 9680 | |
| 9681 | err = alc_auto_add_mic_boost(codec); |
| 9682 | if (err < 0) |
| 9683 | return err; |
| 9684 | |
| 9685 | /* hack - override the init verbs */ |
| 9686 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9687 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9688 | /* setup input_mux for ALC889 */ |
| 9689 | if (codec->vendor_id == 0x10ec0889) { |
| 9690 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9691 | * because it's under 0x18 |
| 9692 | */ |
| 9693 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9694 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9695 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9696 | for (i = 1; i < 3; i++) |
| 9697 | memcpy(&spec->private_imux[i], |
| 9698 | &spec->private_imux[0], |
| 9699 | sizeof(spec->private_imux[0])); |
| 9700 | imux->items[imux->num_items].label = "Int DMic"; |
| 9701 | imux->items[imux->num_items].index = 0x0b; |
| 9702 | imux->num_items++; |
| 9703 | spec->num_mux_defs = 3; |
| 9704 | spec->input_mux = spec->private_imux; |
| 9705 | } |
| 9706 | } |
| 9707 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9708 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9709 | } |
| 9710 | |
| 9711 | /* additional initialization for auto-configuration model */ |
| 9712 | static void alc883_auto_init(struct hda_codec *codec) |
| 9713 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9714 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9715 | alc883_auto_init_multi_out(codec); |
| 9716 | alc883_auto_init_hp_out(codec); |
| 9717 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9718 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9719 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9720 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9721 | } |
| 9722 | |
| 9723 | static int patch_alc883(struct hda_codec *codec) |
| 9724 | { |
| 9725 | struct alc_spec *spec; |
| 9726 | int err, board_config; |
| 9727 | |
| 9728 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9729 | if (spec == NULL) |
| 9730 | return -ENOMEM; |
| 9731 | |
| 9732 | codec->spec = spec; |
| 9733 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9734 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9735 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9736 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9737 | alc883_models, |
| 9738 | alc883_cfg_tbl); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9739 | if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { |
| 9740 | /* Pick up systems that don't supply PCI SSID */ |
| 9741 | switch (codec->subsystem_id) { |
| 9742 | case 0x106b3600: /* Macbook 3.1 */ |
| 9743 | board_config = ALC889A_MB31; |
| 9744 | break; |
| 9745 | default: |
| 9746 | printk(KERN_INFO |
| 9747 | "hda_codec: Unknown model for %s, trying " |
| 9748 | "auto-probe from BIOS...\n", codec->chip_name); |
| 9749 | board_config = ALC883_AUTO; |
| 9750 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9751 | } |
| 9752 | |
| 9753 | if (board_config == ALC883_AUTO) { |
| 9754 | /* automatic parse from the BIOS config */ |
| 9755 | err = alc883_parse_auto_config(codec); |
| 9756 | if (err < 0) { |
| 9757 | alc_free(codec); |
| 9758 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9759 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9760 | printk(KERN_INFO |
| 9761 | "hda_codec: Cannot set up configuration " |
| 9762 | "from BIOS. Using base mode...\n"); |
| 9763 | board_config = ALC883_3ST_2ch_DIG; |
| 9764 | } |
| 9765 | } |
| 9766 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9767 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9768 | if (err < 0) { |
| 9769 | alc_free(codec); |
| 9770 | return err; |
| 9771 | } |
| 9772 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9773 | if (board_config != ALC883_AUTO) |
| 9774 | setup_preset(spec, &alc883_presets[board_config]); |
| 9775 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9776 | switch (codec->vendor_id) { |
| 9777 | case 0x10ec0888: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9778 | if (!spec->num_adc_nids) { |
| 9779 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9780 | spec->adc_nids = alc883_adc_nids; |
| 9781 | } |
| 9782 | if (!spec->capsrc_nids) |
| 9783 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9784 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9785 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9786 | break; |
| 9787 | case 0x10ec0889: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9788 | if (!spec->num_adc_nids) { |
| 9789 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9790 | spec->adc_nids = alc889_adc_nids; |
| 9791 | } |
| 9792 | if (!spec->capsrc_nids) |
| 9793 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9794 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9795 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9796 | break; |
| 9797 | default: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9798 | if (!spec->num_adc_nids) { |
| 9799 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9800 | spec->adc_nids = alc883_adc_nids; |
| 9801 | } |
| 9802 | if (!spec->capsrc_nids) |
| 9803 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9804 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9805 | break; |
| 9806 | } |
| 9807 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9808 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9809 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9810 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9811 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9812 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9813 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9814 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9815 | if (!spec->cap_mixer) |
| 9816 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9817 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9818 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9819 | spec->vmaster_nid = 0x0c; |
| 9820 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9821 | codec->patch_ops = alc_patch_ops; |
| 9822 | if (board_config == ALC883_AUTO) |
| 9823 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9824 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9825 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9826 | if (!spec->loopback.amplist) |
| 9827 | spec->loopback.amplist = alc883_loopbacks; |
| 9828 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9829 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9830 | |
| 9831 | return 0; |
| 9832 | } |
| 9833 | |
| 9834 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9835 | * ALC262 support |
| 9836 | */ |
| 9837 | |
| 9838 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9839 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9840 | |
| 9841 | #define alc262_dac_nids alc260_dac_nids |
| 9842 | #define alc262_adc_nids alc882_adc_nids |
| 9843 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9844 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9845 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9846 | |
| 9847 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9848 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9849 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9850 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9851 | /* ADC0 */ |
| 9852 | 0x09 |
| 9853 | }; |
| 9854 | |
| 9855 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9856 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9857 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9858 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9859 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9860 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9861 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9862 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9863 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9864 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9865 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9866 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9867 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9868 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9869 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9870 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9871 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9872 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9873 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9874 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9875 | }; |
| 9876 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9877 | /* update HP, line and mono-out pins according to the master switch */ |
| 9878 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9879 | { |
| 9880 | struct alc_spec *spec = codec->spec; |
| 9881 | int val = spec->master_sw; |
| 9882 | |
| 9883 | /* HP & line-out */ |
| 9884 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9885 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9886 | val ? PIN_HP : 0); |
| 9887 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9888 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9889 | val ? PIN_HP : 0); |
| 9890 | /* mono (speaker) depending on the HP jack sense */ |
| 9891 | val = val && !spec->jack_present; |
| 9892 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9893 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9894 | val ? PIN_OUT : 0); |
| 9895 | } |
| 9896 | |
| 9897 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9898 | { |
| 9899 | struct alc_spec *spec = codec->spec; |
| 9900 | unsigned int presence; |
| 9901 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9902 | AC_VERB_GET_PIN_SENSE, 0); |
| 9903 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9904 | alc262_hp_master_update(codec); |
| 9905 | } |
| 9906 | |
| 9907 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9908 | { |
| 9909 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9910 | return; |
| 9911 | alc262_hp_bpc_automute(codec); |
| 9912 | } |
| 9913 | |
| 9914 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9915 | { |
| 9916 | struct alc_spec *spec = codec->spec; |
| 9917 | unsigned int presence; |
| 9918 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9919 | AC_VERB_GET_PIN_SENSE, 0); |
| 9920 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9921 | alc262_hp_master_update(codec); |
| 9922 | } |
| 9923 | |
| 9924 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9925 | unsigned int res) |
| 9926 | { |
| 9927 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9928 | return; |
| 9929 | alc262_hp_wildwest_automute(codec); |
| 9930 | } |
| 9931 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9932 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9933 | |
| 9934 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9935 | struct snd_ctl_elem_value *ucontrol) |
| 9936 | { |
| 9937 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9938 | struct alc_spec *spec = codec->spec; |
| 9939 | int val = !!*ucontrol->value.integer.value; |
| 9940 | |
| 9941 | if (val == spec->master_sw) |
| 9942 | return 0; |
| 9943 | spec->master_sw = val; |
| 9944 | alc262_hp_master_update(codec); |
| 9945 | return 1; |
| 9946 | } |
| 9947 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9948 | #define ALC262_HP_MASTER_SWITCH \ |
| 9949 | { \ |
| 9950 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9951 | .name = "Master Playback Switch", \ |
| 9952 | .info = snd_ctl_boolean_mono_info, \ |
| 9953 | .get = alc262_hp_master_sw_get, \ |
| 9954 | .put = alc262_hp_master_sw_put, \ |
| 9955 | } |
| 9956 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9957 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9958 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9960 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9961 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9962 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9963 | HDA_OUTPUT), |
| 9964 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9965 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9966 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9967 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9968 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9969 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9970 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9971 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9972 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9973 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9974 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9975 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9976 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9977 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9978 | { } /* end */ |
| 9979 | }; |
| 9980 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9981 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9982 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9984 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9985 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9986 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9987 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9988 | HDA_OUTPUT), |
| 9989 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9990 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9991 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9992 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9993 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9994 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9995 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9996 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9997 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9998 | { } /* end */ |
| 9999 | }; |
| 10000 | |
| 10001 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10002 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10003 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10004 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10005 | { } /* end */ |
| 10006 | }; |
| 10007 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10008 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10009 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10010 | { |
| 10011 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10012 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10013 | spec->autocfg.hp_pins[0] = 0x15; |
| 10014 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 10015 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10016 | } |
| 10017 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10018 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10019 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10020 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10021 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10022 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10024 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10025 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10026 | { } /* end */ |
| 10027 | }; |
| 10028 | |
| 10029 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10030 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10031 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10032 | |
| 10033 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10034 | { } |
| 10035 | }; |
| 10036 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10037 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10038 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10039 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10040 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10041 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10043 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10044 | { } /* end */ |
| 10045 | }; |
| 10046 | |
| 10047 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10048 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10049 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10050 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10051 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10052 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10053 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10055 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10056 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10057 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10058 | {} |
| 10059 | }; |
| 10060 | |
| 10061 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10062 | .num_items = 1, |
| 10063 | .items = { |
| 10064 | { "Line", 0x1 }, |
| 10065 | }, |
| 10066 | }; |
| 10067 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10068 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10069 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10070 | { |
| 10071 | struct alc_spec *spec = codec->spec; |
| 10072 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10073 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10074 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10075 | unsigned int mute; |
| 10076 | |
| 10077 | /* HP */ |
| 10078 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10079 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10080 | HDA_AMP_MUTE, mute); |
| 10081 | /* mute internal speaker per jack sense */ |
| 10082 | if (spec->jack_present) |
| 10083 | mute = HDA_AMP_MUTE; |
| 10084 | if (line_nid) |
| 10085 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10086 | HDA_AMP_MUTE, mute); |
| 10087 | if (speaker_nid && speaker_nid != line_nid) |
| 10088 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10089 | HDA_AMP_MUTE, mute); |
| 10090 | } |
| 10091 | |
| 10092 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10093 | |
| 10094 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10095 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10096 | { |
| 10097 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10098 | struct alc_spec *spec = codec->spec; |
| 10099 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10100 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10101 | if (val == spec->master_sw) |
| 10102 | return 0; |
| 10103 | spec->master_sw = val; |
| 10104 | alc262_hippo_master_update(codec); |
| 10105 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10106 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10107 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10108 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10109 | { \ |
| 10110 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10111 | .name = "Master Playback Switch", \ |
| 10112 | .info = snd_ctl_boolean_mono_info, \ |
| 10113 | .get = alc262_hippo_master_sw_get, \ |
| 10114 | .put = alc262_hippo_master_sw_put, \ |
| 10115 | } |
| 10116 | |
| 10117 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10118 | ALC262_HIPPO_MASTER_SWITCH, |
| 10119 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10120 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10121 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10122 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10123 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10125 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10126 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10127 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10128 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10129 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10130 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10131 | { } /* end */ |
| 10132 | }; |
| 10133 | |
| 10134 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10135 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10136 | ALC262_HIPPO_MASTER_SWITCH, |
| 10137 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10138 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10139 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10140 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10141 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10142 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10143 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10144 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10145 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10146 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10147 | { } /* end */ |
| 10148 | }; |
| 10149 | |
| 10150 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10151 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10152 | { |
| 10153 | struct alc_spec *spec = codec->spec; |
| 10154 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10155 | unsigned int present; |
| 10156 | |
| 10157 | /* need to execute and sync at first */ |
| 10158 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10159 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 10160 | AC_VERB_GET_PIN_SENSE, 0); |
| 10161 | spec->jack_present = (present & 0x80000000) != 0; |
| 10162 | alc262_hippo_master_update(codec); |
| 10163 | } |
| 10164 | |
| 10165 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10166 | { |
| 10167 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10168 | return; |
| 10169 | alc262_hippo_automute(codec); |
| 10170 | } |
| 10171 | |
| 10172 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 10173 | { |
| 10174 | struct alc_spec *spec = codec->spec; |
| 10175 | |
| 10176 | spec->autocfg.hp_pins[0] = 0x15; |
| 10177 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10178 | alc262_hippo_automute(codec); |
| 10179 | } |
| 10180 | |
| 10181 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 10182 | { |
| 10183 | struct alc_spec *spec = codec->spec; |
| 10184 | |
| 10185 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10186 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10187 | alc262_hippo_automute(codec); |
| 10188 | } |
| 10189 | |
| 10190 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10191 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10192 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10193 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10194 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10195 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10196 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10197 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10198 | { } /* end */ |
| 10199 | }; |
| 10200 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10201 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10202 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10203 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10204 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10206 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10207 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10208 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10209 | { } /* end */ |
| 10210 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10211 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10212 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10213 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10214 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10215 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10216 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10217 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10218 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10221 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10222 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10223 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10224 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10225 | { } /* end */ |
| 10226 | }; |
| 10227 | |
| 10228 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10229 | /* Headphone automute */ |
| 10230 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10231 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10232 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10233 | |
| 10234 | /* P11 AUX_IN, white 4-pin connector */ |
| 10235 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10236 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10237 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10238 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10239 | |
| 10240 | {} |
| 10241 | }; |
| 10242 | |
| 10243 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10244 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10245 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10246 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10247 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10248 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10249 | spec->autocfg.speaker_pins[0] = 0x15; |
| 10250 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10251 | } |
| 10252 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10253 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10254 | #define alc262_capture_mixer alc882_capture_mixer |
| 10255 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10256 | |
| 10257 | /* |
| 10258 | * generic initialization of ADC, input mixers and output mixers |
| 10259 | */ |
| 10260 | static struct hda_verb alc262_init_verbs[] = { |
| 10261 | /* |
| 10262 | * Unmute ADC0-2 and set the default input to mic-in |
| 10263 | */ |
| 10264 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10265 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10266 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10268 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10270 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10271 | /* 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] | 10272 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10273 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10274 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10275 | */ |
| 10276 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10277 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10279 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10280 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10281 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10282 | |
| 10283 | /* |
| 10284 | * Set up output mixers (0x0c - 0x0e) |
| 10285 | */ |
| 10286 | /* set vol=0 to output mixers */ |
| 10287 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10288 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10289 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10290 | /* set up input amps for analog loopback */ |
| 10291 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10292 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10294 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10296 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10298 | |
| 10299 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10300 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10301 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10302 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10303 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10304 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10305 | |
| 10306 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10307 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10308 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10309 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10310 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10311 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10312 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10313 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10314 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10315 | /* FIXME: use matrix-type input source selection */ |
| 10316 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10317 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10320 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10322 | /* Input mixer2 */ |
| 10323 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10324 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10325 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10327 | /* Input mixer3 */ |
| 10328 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10329 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10330 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10332 | |
| 10333 | { } |
| 10334 | }; |
| 10335 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10336 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10337 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10338 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10339 | { } |
| 10340 | }; |
| 10341 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10342 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 10343 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10344 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10345 | {} |
| 10346 | }; |
| 10347 | |
| 10348 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10349 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10350 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10351 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10352 | |
| 10353 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10354 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10355 | {} |
| 10356 | }; |
| 10357 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10358 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10359 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10360 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10361 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10362 | |
| 10363 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10364 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10365 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10366 | }; |
| 10367 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10368 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 10369 | .num_items = 2, |
| 10370 | .items = { |
| 10371 | { "Int DMic", 0x9 }, |
| 10372 | { "Mic", 0x0 }, |
| 10373 | }, |
| 10374 | }; |
| 10375 | |
| 10376 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10377 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10378 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10379 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10380 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10381 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10382 | { } /* end */ |
| 10383 | }; |
| 10384 | |
| 10385 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10386 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10387 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10388 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10389 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10390 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10391 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10392 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10393 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10394 | {} |
| 10395 | }; |
| 10396 | |
| 10397 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 10398 | { |
| 10399 | unsigned int present; |
| 10400 | |
| 10401 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10402 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10403 | snd_hda_codec_write(codec, 0x22, 0, |
| 10404 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 10405 | } |
| 10406 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10407 | |
| 10408 | /* unsolicited event for HP jack sensing */ |
| 10409 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 10410 | unsigned int res) |
| 10411 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10412 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10413 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10414 | else |
| 10415 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10416 | } |
| 10417 | |
| 10418 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10419 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10420 | struct alc_spec *spec = codec->spec; |
| 10421 | |
| 10422 | spec->autocfg.hp_pins[0] = 0x15; |
| 10423 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10424 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10425 | alc262_dmic_automute(codec); |
| 10426 | } |
| 10427 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10428 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10429 | * nec model |
| 10430 | * 0x15 = headphone |
| 10431 | * 0x16 = internal speaker |
| 10432 | * 0x18 = external mic |
| 10433 | */ |
| 10434 | |
| 10435 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10436 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10437 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10438 | |
| 10439 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10440 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10441 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10442 | |
| 10443 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10444 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10445 | { } /* end */ |
| 10446 | }; |
| 10447 | |
| 10448 | static struct hda_verb alc262_nec_verbs[] = { |
| 10449 | /* Unmute Speaker */ |
| 10450 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10451 | |
| 10452 | /* Headphone */ |
| 10453 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10454 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10455 | |
| 10456 | /* External mic to headphone */ |
| 10457 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10458 | /* External mic to speaker */ |
| 10459 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10460 | {} |
| 10461 | }; |
| 10462 | |
| 10463 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10464 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10465 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10466 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10467 | */ |
| 10468 | |
| 10469 | #define ALC_HP_EVENT 0x37 |
| 10470 | |
| 10471 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10472 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10473 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10474 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10475 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10476 | {} |
| 10477 | }; |
| 10478 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10479 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10480 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10481 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10482 | {} |
| 10483 | }; |
| 10484 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10485 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10486 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10487 | .items = { |
| 10488 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10489 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10490 | { "CD", 0x4 }, |
| 10491 | }, |
| 10492 | }; |
| 10493 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10494 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10495 | .num_items = 5, |
| 10496 | .items = { |
| 10497 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10498 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10499 | { "Line", 0x2 }, |
| 10500 | { "CD", 0x4 }, |
| 10501 | { "AUX IN", 0x6 }, |
| 10502 | }, |
| 10503 | }; |
| 10504 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10505 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10506 | .num_items = 4, |
| 10507 | .items = { |
| 10508 | { "Mic", 0x0 }, |
| 10509 | { "Front Mic", 0x2 }, |
| 10510 | { "Line", 0x1 }, |
| 10511 | { "CD", 0x4 }, |
| 10512 | }, |
| 10513 | }; |
| 10514 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10515 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10516 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10517 | { |
| 10518 | struct alc_spec *spec = codec->spec; |
| 10519 | unsigned int mute; |
| 10520 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10521 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10522 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10523 | /* need to execute and sync at first */ |
| 10524 | 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] | 10525 | /* check laptop HP jack */ |
| 10526 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10527 | AC_VERB_GET_PIN_SENSE, 0); |
| 10528 | /* need to execute and sync at first */ |
| 10529 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10530 | /* check docking HP jack */ |
| 10531 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10532 | AC_VERB_GET_PIN_SENSE, 0); |
| 10533 | if (present & AC_PINSENSE_PRESENCE) |
| 10534 | spec->jack_present = 1; |
| 10535 | else |
| 10536 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10537 | spec->sense_updated = 1; |
| 10538 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10539 | /* unmute internal speaker only if both HPs are unplugged and |
| 10540 | * master switch is on |
| 10541 | */ |
| 10542 | if (spec->jack_present) |
| 10543 | mute = HDA_AMP_MUTE; |
| 10544 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10545 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10546 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10547 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10548 | } |
| 10549 | |
| 10550 | /* unsolicited event for HP jack sensing */ |
| 10551 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10552 | unsigned int res) |
| 10553 | { |
| 10554 | if ((res >> 26) != ALC_HP_EVENT) |
| 10555 | return; |
| 10556 | alc262_fujitsu_automute(codec, 1); |
| 10557 | } |
| 10558 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10559 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10560 | { |
| 10561 | alc262_fujitsu_automute(codec, 1); |
| 10562 | } |
| 10563 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10564 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10565 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10566 | .ops = &snd_hda_bind_vol, |
| 10567 | .values = { |
| 10568 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10569 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10570 | 0 |
| 10571 | }, |
| 10572 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10573 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10574 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10575 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10576 | { |
| 10577 | struct alc_spec *spec = codec->spec; |
| 10578 | unsigned int mute; |
| 10579 | |
| 10580 | if (force || !spec->sense_updated) { |
| 10581 | unsigned int present_int_hp; |
| 10582 | /* need to execute and sync at first */ |
| 10583 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10584 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10585 | AC_VERB_GET_PIN_SENSE, 0); |
| 10586 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10587 | spec->sense_updated = 1; |
| 10588 | } |
| 10589 | if (spec->jack_present) { |
| 10590 | /* mute internal speaker */ |
| 10591 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10592 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10593 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10594 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10595 | } else { |
| 10596 | /* unmute internal speaker if necessary */ |
| 10597 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10598 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10599 | HDA_AMP_MUTE, mute); |
| 10600 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10601 | HDA_AMP_MUTE, mute); |
| 10602 | } |
| 10603 | } |
| 10604 | |
| 10605 | /* unsolicited event for HP jack sensing */ |
| 10606 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10607 | unsigned int res) |
| 10608 | { |
| 10609 | if ((res >> 26) != ALC_HP_EVENT) |
| 10610 | return; |
| 10611 | alc262_lenovo_3000_automute(codec, 1); |
| 10612 | } |
| 10613 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10614 | /* bind hp and internal speaker mute (with plug check) */ |
| 10615 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10616 | struct snd_ctl_elem_value *ucontrol) |
| 10617 | { |
| 10618 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10619 | long *valp = ucontrol->value.integer.value; |
| 10620 | int change; |
| 10621 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10622 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10623 | HDA_AMP_MUTE, |
| 10624 | valp ? 0 : HDA_AMP_MUTE); |
| 10625 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10626 | HDA_AMP_MUTE, |
| 10627 | valp ? 0 : HDA_AMP_MUTE); |
| 10628 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10629 | if (change) |
| 10630 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10631 | return change; |
| 10632 | } |
| 10633 | |
| 10634 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10635 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10636 | { |
| 10637 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10638 | .name = "Master Playback Switch", |
| 10639 | .info = snd_hda_mixer_amp_switch_info, |
| 10640 | .get = snd_hda_mixer_amp_switch_get, |
| 10641 | .put = alc262_fujitsu_master_sw_put, |
| 10642 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10643 | }, |
| 10644 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10645 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10646 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10647 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10649 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10650 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10651 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10652 | { } /* end */ |
| 10653 | }; |
| 10654 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10655 | /* bind hp and internal speaker mute (with plug check) */ |
| 10656 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10657 | struct snd_ctl_elem_value *ucontrol) |
| 10658 | { |
| 10659 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10660 | long *valp = ucontrol->value.integer.value; |
| 10661 | int change; |
| 10662 | |
| 10663 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10664 | HDA_AMP_MUTE, |
| 10665 | valp ? 0 : HDA_AMP_MUTE); |
| 10666 | |
| 10667 | if (change) |
| 10668 | alc262_lenovo_3000_automute(codec, 0); |
| 10669 | return change; |
| 10670 | } |
| 10671 | |
| 10672 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10673 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10674 | { |
| 10675 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10676 | .name = "Master Playback Switch", |
| 10677 | .info = snd_hda_mixer_amp_switch_info, |
| 10678 | .get = snd_hda_mixer_amp_switch_get, |
| 10679 | .put = alc262_lenovo_3000_master_sw_put, |
| 10680 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10681 | }, |
| 10682 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10683 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10684 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10685 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10686 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10687 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10688 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10689 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10690 | { } /* end */ |
| 10691 | }; |
| 10692 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10693 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10694 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10695 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10696 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10697 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10698 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10699 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10700 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10701 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10702 | { } /* end */ |
| 10703 | }; |
| 10704 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10705 | /* additional init verbs for Benq laptops */ |
| 10706 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10707 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10708 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10709 | {} |
| 10710 | }; |
| 10711 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10712 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10713 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10714 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10715 | |
| 10716 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10717 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10718 | {} |
| 10719 | }; |
| 10720 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10721 | /* Samsung Q1 Ultra Vista model setup */ |
| 10722 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10723 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10724 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10725 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10726 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10727 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10728 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10729 | { } /* end */ |
| 10730 | }; |
| 10731 | |
| 10732 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10733 | /* output mixer */ |
| 10734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10735 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10737 | /* speaker */ |
| 10738 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10739 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10740 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10741 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10742 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10743 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10744 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10746 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10747 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10748 | /* internal mic */ |
| 10749 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10750 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10751 | /* ADC, choose mic */ |
| 10752 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10754 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10755 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10756 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10757 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10758 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10759 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10760 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10761 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10762 | {} |
| 10763 | }; |
| 10764 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10765 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10766 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10767 | { |
| 10768 | struct alc_spec *spec = codec->spec; |
| 10769 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10770 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10771 | mute = 0; |
| 10772 | /* auto-mute only when HP is used as HP */ |
| 10773 | if (!spec->cur_mux[0]) { |
| 10774 | unsigned int present; |
| 10775 | /* need to execute and sync at first */ |
| 10776 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10777 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10778 | AC_VERB_GET_PIN_SENSE, 0); |
| 10779 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10780 | if (spec->jack_present) |
| 10781 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10782 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10783 | /* mute/unmute internal speaker */ |
| 10784 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10785 | HDA_AMP_MUTE, mute); |
| 10786 | /* mute/unmute HP */ |
| 10787 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10788 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10789 | } |
| 10790 | |
| 10791 | /* unsolicited event for HP jack sensing */ |
| 10792 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10793 | unsigned int res) |
| 10794 | { |
| 10795 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10796 | return; |
| 10797 | alc262_ultra_automute(codec); |
| 10798 | } |
| 10799 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10800 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10801 | .num_items = 2, |
| 10802 | .items = { |
| 10803 | { "Mic", 0x1 }, |
| 10804 | { "Headphone", 0x7 }, |
| 10805 | }, |
| 10806 | }; |
| 10807 | |
| 10808 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10809 | struct snd_ctl_elem_value *ucontrol) |
| 10810 | { |
| 10811 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10812 | struct alc_spec *spec = codec->spec; |
| 10813 | int ret; |
| 10814 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10815 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10816 | if (!ret) |
| 10817 | return 0; |
| 10818 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10819 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10820 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10821 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10822 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10823 | return ret; |
| 10824 | } |
| 10825 | |
| 10826 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10827 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10828 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10829 | { |
| 10830 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10831 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10832 | .info = alc_mux_enum_info, |
| 10833 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10834 | .put = alc262_ultra_mux_enum_put, |
| 10835 | }, |
| 10836 | { } /* end */ |
| 10837 | }; |
| 10838 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10839 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10840 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10841 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10842 | { |
| 10843 | hda_nid_t nid; |
| 10844 | int err; |
| 10845 | |
| 10846 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10847 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10848 | spec->multiout.dac_nids[0] = 2; |
| 10849 | |
| 10850 | nid = cfg->line_out_pins[0]; |
| 10851 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10852 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10853 | "Front Playback Volume", |
| 10854 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10855 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10856 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10857 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10858 | "Front Playback Switch", |
| 10859 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10860 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10861 | return err; |
| 10862 | } |
| 10863 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10864 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10865 | if (nid) { |
| 10866 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10867 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10868 | "Speaker Playback Volume", |
| 10869 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10870 | HDA_OUTPUT)); |
| 10871 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10872 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10873 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10874 | "Speaker Playback Switch", |
| 10875 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10876 | HDA_OUTPUT)); |
| 10877 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10878 | return err; |
| 10879 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10880 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10881 | "Speaker Playback Switch", |
| 10882 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10883 | HDA_OUTPUT)); |
| 10884 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10885 | return err; |
| 10886 | } |
| 10887 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10888 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10889 | if (nid) { |
| 10890 | /* spec->multiout.hp_nid = 2; */ |
| 10891 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10892 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10893 | "Headphone Playback Volume", |
| 10894 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10895 | HDA_OUTPUT)); |
| 10896 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10897 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10898 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10899 | "Headphone Playback Switch", |
| 10900 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10901 | HDA_OUTPUT)); |
| 10902 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10903 | return err; |
| 10904 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10905 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10906 | "Headphone Playback Switch", |
| 10907 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10908 | HDA_OUTPUT)); |
| 10909 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10910 | return err; |
| 10911 | } |
| 10912 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10913 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10914 | } |
| 10915 | |
| 10916 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10917 | #define alc262_auto_create_analog_input_ctls \ |
| 10918 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10919 | |
| 10920 | /* |
| 10921 | * generic initialization of ADC, input mixers and output mixers |
| 10922 | */ |
| 10923 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10924 | /* |
| 10925 | * Unmute ADC0-2 and set the default input to mic-in |
| 10926 | */ |
| 10927 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10929 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10930 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10931 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10932 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10933 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10934 | /* 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] | 10935 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10936 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10937 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10938 | */ |
| 10939 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10940 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10941 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10942 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10943 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10944 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10945 | |
| 10946 | /* |
| 10947 | * Set up output mixers (0x0c - 0x0f) |
| 10948 | */ |
| 10949 | /* set vol=0 to output mixers */ |
| 10950 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10951 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10952 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10953 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10954 | /* set up input amps for analog loopback */ |
| 10955 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10956 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10958 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10959 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10960 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10961 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10962 | |
| 10963 | /* FIXME: use matrix-type input source selection */ |
| 10964 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10965 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10966 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10967 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10968 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10969 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10970 | /* Input mixer2 */ |
| 10971 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10972 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10973 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10974 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10975 | /* Input mixer3 */ |
| 10976 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10979 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10980 | |
| 10981 | { } |
| 10982 | }; |
| 10983 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10984 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10985 | /* |
| 10986 | * Unmute ADC0-2 and set the default input to mic-in |
| 10987 | */ |
| 10988 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10990 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10991 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10992 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10993 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10994 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10995 | /* 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] | 10996 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10997 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10998 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10999 | */ |
| 11000 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11001 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11002 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11003 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11006 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11008 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11009 | /* |
| 11010 | * Set up output mixers (0x0c - 0x0e) |
| 11011 | */ |
| 11012 | /* set vol=0 to output mixers */ |
| 11013 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11014 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11015 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11016 | |
| 11017 | /* set up input amps for analog loopback */ |
| 11018 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11022 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11023 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11024 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11025 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11026 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11028 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11029 | |
| 11030 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11031 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11032 | |
| 11033 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11034 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11035 | |
| 11036 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11037 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11038 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11039 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11040 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11041 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11042 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11043 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11044 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11045 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11046 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11047 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11048 | |
| 11049 | |
| 11050 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11051 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11052 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11054 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11055 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11056 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11057 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11059 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11062 | /* Input mixer2 */ |
| 11063 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11064 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11065 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11066 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11067 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11069 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11071 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11072 | /* Input mixer3 */ |
| 11073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11074 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11075 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11076 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11077 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11082 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11083 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11084 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11085 | { } |
| 11086 | }; |
| 11087 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11088 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11089 | /* |
| 11090 | * Unmute ADC0-2 and set the default input to mic-in |
| 11091 | */ |
| 11092 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11093 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11094 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11095 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11096 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11097 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11098 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11099 | /* 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] | 11100 | * mixer widget |
| 11101 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11102 | * panel mic (mic 2) |
| 11103 | */ |
| 11104 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11105 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11106 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11107 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11108 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11109 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11113 | /* |
| 11114 | * Set up output mixers (0x0c - 0x0e) |
| 11115 | */ |
| 11116 | /* set vol=0 to output mixers */ |
| 11117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11119 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11120 | |
| 11121 | /* set up input amps for analog loopback */ |
| 11122 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11123 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11124 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11125 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11126 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11127 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11128 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11129 | |
| 11130 | |
| 11131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11132 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11133 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11134 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11135 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11136 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11137 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11138 | |
| 11139 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11140 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11141 | |
| 11142 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11143 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11144 | |
| 11145 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11146 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11148 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11149 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11150 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11151 | |
| 11152 | /* FIXME: use matrix-type input source selection */ |
| 11153 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11154 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11155 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11156 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11157 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11158 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11159 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11160 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11161 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11162 | /* Input mixer2 */ |
| 11163 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11164 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11165 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11166 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11167 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11168 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11169 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11170 | /* Input mixer3 */ |
| 11171 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11172 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11173 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11174 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11175 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11176 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11178 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11179 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11180 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11181 | { } |
| 11182 | }; |
| 11183 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11184 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11185 | |
| 11186 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11187 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11188 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11189 | |
| 11190 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11191 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11192 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11193 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11194 | |
| 11195 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11196 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11197 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11198 | {} |
| 11199 | }; |
| 11200 | |
| 11201 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11202 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11203 | #define alc262_loopbacks alc880_loopbacks |
| 11204 | #endif |
| 11205 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11206 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11207 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11208 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11209 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11210 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11211 | |
| 11212 | /* |
| 11213 | * BIOS auto configuration |
| 11214 | */ |
| 11215 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11216 | { |
| 11217 | struct alc_spec *spec = codec->spec; |
| 11218 | int err; |
| 11219 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11220 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11221 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11222 | alc262_ignore); |
| 11223 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11224 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11225 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11226 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11227 | spec->multiout.max_channels = 2; |
| 11228 | spec->no_analog = 1; |
| 11229 | goto dig_only; |
| 11230 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11231 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11232 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11233 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11234 | if (err < 0) |
| 11235 | return err; |
| 11236 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11237 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11238 | return err; |
| 11239 | |
| 11240 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11241 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11242 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11243 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11244 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11245 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11246 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11247 | if (spec->autocfg.dig_in_pin) |
| 11248 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11249 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11250 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11251 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11252 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11253 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11254 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11255 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11256 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11257 | err = alc_auto_add_mic_boost(codec); |
| 11258 | if (err < 0) |
| 11259 | return err; |
| 11260 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11261 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11262 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11263 | return 1; |
| 11264 | } |
| 11265 | |
| 11266 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11267 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11268 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11269 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11270 | |
| 11271 | |
| 11272 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11273 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11274 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11275 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11276 | alc262_auto_init_multi_out(codec); |
| 11277 | alc262_auto_init_hp_out(codec); |
| 11278 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11279 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11280 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11281 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11282 | } |
| 11283 | |
| 11284 | /* |
| 11285 | * configuration and preset |
| 11286 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11287 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11288 | [ALC262_BASIC] = "basic", |
| 11289 | [ALC262_HIPPO] = "hippo", |
| 11290 | [ALC262_HIPPO_1] = "hippo_1", |
| 11291 | [ALC262_FUJITSU] = "fujitsu", |
| 11292 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11293 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11294 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11295 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11296 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11297 | [ALC262_BENQ_T31] = "benq-t31", |
| 11298 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11299 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11300 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11301 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11302 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11303 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11304 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11305 | [ALC262_AUTO] = "auto", |
| 11306 | }; |
| 11307 | |
| 11308 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11309 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11310 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11311 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11312 | ALC262_HP_BPC), |
| 11313 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11314 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11315 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11316 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11317 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11318 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11319 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11320 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11321 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11322 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11323 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11324 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11325 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11326 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11327 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11328 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11329 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11330 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11331 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11332 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11333 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11334 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame^] | 11335 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11336 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11337 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11338 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11339 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11340 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11341 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11342 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11343 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11344 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11345 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11346 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11347 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11348 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11349 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11350 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11351 | {} |
| 11352 | }; |
| 11353 | |
| 11354 | static struct alc_config_preset alc262_presets[] = { |
| 11355 | [ALC262_BASIC] = { |
| 11356 | .mixers = { alc262_base_mixer }, |
| 11357 | .init_verbs = { alc262_init_verbs }, |
| 11358 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11359 | .dac_nids = alc262_dac_nids, |
| 11360 | .hp_nid = 0x03, |
| 11361 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11362 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11363 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11364 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11365 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11366 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11367 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 11368 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11369 | .dac_nids = alc262_dac_nids, |
| 11370 | .hp_nid = 0x03, |
| 11371 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11372 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11373 | .channel_mode = alc262_modes, |
| 11374 | .input_mux = &alc262_capture_source, |
| 11375 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11376 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11377 | }, |
| 11378 | [ALC262_HIPPO_1] = { |
| 11379 | .mixers = { alc262_hippo1_mixer }, |
| 11380 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11381 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11382 | .dac_nids = alc262_dac_nids, |
| 11383 | .hp_nid = 0x02, |
| 11384 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11385 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11386 | .channel_mode = alc262_modes, |
| 11387 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11388 | .unsol_event = alc262_hippo_unsol_event, |
| 11389 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11390 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11391 | [ALC262_FUJITSU] = { |
| 11392 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11393 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11394 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11395 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11396 | .dac_nids = alc262_dac_nids, |
| 11397 | .hp_nid = 0x03, |
| 11398 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11399 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11400 | .channel_mode = alc262_modes, |
| 11401 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11402 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11403 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11404 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11405 | [ALC262_HP_BPC] = { |
| 11406 | .mixers = { alc262_HP_BPC_mixer }, |
| 11407 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11408 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11409 | .dac_nids = alc262_dac_nids, |
| 11410 | .hp_nid = 0x03, |
| 11411 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11412 | .channel_mode = alc262_modes, |
| 11413 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11414 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11415 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11416 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11417 | [ALC262_HP_BPC_D7000_WF] = { |
| 11418 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11419 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11420 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11421 | .dac_nids = alc262_dac_nids, |
| 11422 | .hp_nid = 0x03, |
| 11423 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11424 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11425 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11426 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11427 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11428 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11429 | [ALC262_HP_BPC_D7000_WL] = { |
| 11430 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11431 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11432 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11433 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11434 | .dac_nids = alc262_dac_nids, |
| 11435 | .hp_nid = 0x03, |
| 11436 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11437 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11438 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11439 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11440 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11441 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11442 | [ALC262_HP_TC_T5735] = { |
| 11443 | .mixers = { alc262_hp_t5735_mixer }, |
| 11444 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11445 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11446 | .dac_nids = alc262_dac_nids, |
| 11447 | .hp_nid = 0x03, |
| 11448 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11449 | .channel_mode = alc262_modes, |
| 11450 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11451 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11452 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11453 | }, |
| 11454 | [ALC262_HP_RP5700] = { |
| 11455 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11456 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11457 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11458 | .dac_nids = alc262_dac_nids, |
| 11459 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11460 | .channel_mode = alc262_modes, |
| 11461 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11462 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11463 | [ALC262_BENQ_ED8] = { |
| 11464 | .mixers = { alc262_base_mixer }, |
| 11465 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11466 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11467 | .dac_nids = alc262_dac_nids, |
| 11468 | .hp_nid = 0x03, |
| 11469 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11470 | .channel_mode = alc262_modes, |
| 11471 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11472 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11473 | [ALC262_SONY_ASSAMD] = { |
| 11474 | .mixers = { alc262_sony_mixer }, |
| 11475 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11476 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11477 | .dac_nids = alc262_dac_nids, |
| 11478 | .hp_nid = 0x02, |
| 11479 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11480 | .channel_mode = alc262_modes, |
| 11481 | .input_mux = &alc262_capture_source, |
| 11482 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11483 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11484 | }, |
| 11485 | [ALC262_BENQ_T31] = { |
| 11486 | .mixers = { alc262_benq_t31_mixer }, |
| 11487 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11488 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11489 | .dac_nids = alc262_dac_nids, |
| 11490 | .hp_nid = 0x03, |
| 11491 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11492 | .channel_mode = alc262_modes, |
| 11493 | .input_mux = &alc262_capture_source, |
| 11494 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11495 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11496 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11497 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11498 | .mixers = { alc262_ultra_mixer }, |
| 11499 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11500 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11501 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11502 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11503 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11504 | .channel_mode = alc262_modes, |
| 11505 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11506 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11507 | .capsrc_nids = alc262_capsrc_nids, |
| 11508 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11509 | .unsol_event = alc262_ultra_unsol_event, |
| 11510 | .init_hook = alc262_ultra_automute, |
| 11511 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11512 | [ALC262_LENOVO_3000] = { |
| 11513 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11514 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11515 | alc262_lenovo_3000_unsol_verbs }, |
| 11516 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11517 | .dac_nids = alc262_dac_nids, |
| 11518 | .hp_nid = 0x03, |
| 11519 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11520 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11521 | .channel_mode = alc262_modes, |
| 11522 | .input_mux = &alc262_fujitsu_capture_source, |
| 11523 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11524 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11525 | [ALC262_NEC] = { |
| 11526 | .mixers = { alc262_nec_mixer }, |
| 11527 | .init_verbs = { alc262_nec_verbs }, |
| 11528 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11529 | .dac_nids = alc262_dac_nids, |
| 11530 | .hp_nid = 0x03, |
| 11531 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11532 | .channel_mode = alc262_modes, |
| 11533 | .input_mux = &alc262_capture_source, |
| 11534 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11535 | [ALC262_TOSHIBA_S06] = { |
| 11536 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11537 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11538 | alc262_eapd_verbs }, |
| 11539 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11540 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11541 | .dac_nids = alc262_dac_nids, |
| 11542 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11543 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11544 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11545 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11546 | .channel_mode = alc262_modes, |
| 11547 | .input_mux = &alc262_dmic_capture_source, |
| 11548 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11549 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11550 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11551 | [ALC262_TOSHIBA_RX1] = { |
| 11552 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11553 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11554 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11555 | .dac_nids = alc262_dac_nids, |
| 11556 | .hp_nid = 0x03, |
| 11557 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11558 | .channel_mode = alc262_modes, |
| 11559 | .input_mux = &alc262_capture_source, |
| 11560 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11561 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11562 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11563 | [ALC262_TYAN] = { |
| 11564 | .mixers = { alc262_tyan_mixer }, |
| 11565 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11566 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11567 | .dac_nids = alc262_dac_nids, |
| 11568 | .hp_nid = 0x02, |
| 11569 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11570 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11571 | .channel_mode = alc262_modes, |
| 11572 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11573 | .unsol_event = alc_automute_amp_unsol_event, |
| 11574 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11575 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11576 | }; |
| 11577 | |
| 11578 | static int patch_alc262(struct hda_codec *codec) |
| 11579 | { |
| 11580 | struct alc_spec *spec; |
| 11581 | int board_config; |
| 11582 | int err; |
| 11583 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11584 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11585 | if (spec == NULL) |
| 11586 | return -ENOMEM; |
| 11587 | |
| 11588 | codec->spec = spec; |
| 11589 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11590 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11591 | * under-run |
| 11592 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11593 | { |
| 11594 | int tmp; |
| 11595 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11596 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11597 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11598 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11599 | } |
| 11600 | #endif |
| 11601 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11602 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11603 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11604 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11605 | alc262_models, |
| 11606 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11607 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11608 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 11609 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 11610 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11611 | board_config = ALC262_AUTO; |
| 11612 | } |
| 11613 | |
| 11614 | if (board_config == ALC262_AUTO) { |
| 11615 | /* automatic parse from the BIOS config */ |
| 11616 | err = alc262_parse_auto_config(codec); |
| 11617 | if (err < 0) { |
| 11618 | alc_free(codec); |
| 11619 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11620 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11621 | printk(KERN_INFO |
| 11622 | "hda_codec: Cannot set up configuration " |
| 11623 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11624 | board_config = ALC262_BASIC; |
| 11625 | } |
| 11626 | } |
| 11627 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11628 | if (!spec->no_analog) { |
| 11629 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11630 | if (err < 0) { |
| 11631 | alc_free(codec); |
| 11632 | return err; |
| 11633 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11634 | } |
| 11635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11636 | if (board_config != ALC262_AUTO) |
| 11637 | setup_preset(spec, &alc262_presets[board_config]); |
| 11638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11639 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11640 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11641 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11642 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11643 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11644 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11645 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11646 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11647 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11648 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11649 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11650 | /* get type */ |
| 11651 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11652 | if (wcap != AC_WID_AUD_IN) { |
| 11653 | spec->adc_nids = alc262_adc_nids_alt; |
| 11654 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11655 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11656 | } else { |
| 11657 | spec->adc_nids = alc262_adc_nids; |
| 11658 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11659 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11660 | } |
| 11661 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11662 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11663 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11664 | if (!spec->no_analog) |
| 11665 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11666 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11667 | spec->vmaster_nid = 0x0c; |
| 11668 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11669 | codec->patch_ops = alc_patch_ops; |
| 11670 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11671 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11672 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11673 | if (!spec->loopback.amplist) |
| 11674 | spec->loopback.amplist = alc262_loopbacks; |
| 11675 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11676 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11677 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11678 | return 0; |
| 11679 | } |
| 11680 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11681 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11682 | * ALC268 channel source setting (2 channel) |
| 11683 | */ |
| 11684 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11685 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11686 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11687 | static hda_nid_t alc268_dac_nids[2] = { |
| 11688 | /* front, hp */ |
| 11689 | 0x02, 0x03 |
| 11690 | }; |
| 11691 | |
| 11692 | static hda_nid_t alc268_adc_nids[2] = { |
| 11693 | /* ADC0-1 */ |
| 11694 | 0x08, 0x07 |
| 11695 | }; |
| 11696 | |
| 11697 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11698 | /* ADC0 */ |
| 11699 | 0x08 |
| 11700 | }; |
| 11701 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11702 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11703 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11704 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11705 | /* output mixer control */ |
| 11706 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11707 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11708 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11709 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11710 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11711 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11712 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11713 | { } |
| 11714 | }; |
| 11715 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11716 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11717 | /* output mixer control */ |
| 11718 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11719 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11720 | ALC262_HIPPO_MASTER_SWITCH, |
| 11721 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11722 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11723 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11724 | { } |
| 11725 | }; |
| 11726 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11727 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11728 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11729 | .ops = &snd_hda_bind_sw, |
| 11730 | .values = { |
| 11731 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11732 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11733 | 0 |
| 11734 | }, |
| 11735 | }; |
| 11736 | |
| 11737 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11738 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11739 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11740 | { } |
| 11741 | }; |
| 11742 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11743 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11744 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11745 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11746 | { } |
| 11747 | }; |
| 11748 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11749 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11750 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11751 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11752 | { } /* end */ |
| 11753 | }; |
| 11754 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11755 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11756 | .num_items = 2, |
| 11757 | .items = { |
| 11758 | { "i-Mic", 0x6 }, |
| 11759 | { "E-Mic", 0x0 }, |
| 11760 | }, |
| 11761 | }; |
| 11762 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11763 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11764 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11765 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11766 | .ops = &snd_hda_bind_vol, |
| 11767 | .values = { |
| 11768 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11769 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11770 | 0 |
| 11771 | }, |
| 11772 | }; |
| 11773 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11774 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11775 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11776 | { |
| 11777 | struct alc_spec *spec = codec->spec; |
| 11778 | unsigned int mute; |
| 11779 | |
| 11780 | if (force || !spec->sense_updated) { |
| 11781 | unsigned int present; |
| 11782 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11783 | AC_VERB_GET_PIN_SENSE, 0); |
| 11784 | spec->jack_present = (present & 0x80000000) != 0; |
| 11785 | spec->sense_updated = 1; |
| 11786 | } |
| 11787 | if (spec->jack_present) |
| 11788 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11789 | else /* unmute internal speaker if necessary */ |
| 11790 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11791 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11792 | HDA_AMP_MUTE, mute); |
| 11793 | } |
| 11794 | |
| 11795 | |
| 11796 | /* bind hp and internal speaker mute (with plug check) */ |
| 11797 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11798 | struct snd_ctl_elem_value *ucontrol) |
| 11799 | { |
| 11800 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11801 | long *valp = ucontrol->value.integer.value; |
| 11802 | int change; |
| 11803 | |
| 11804 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11805 | HDA_AMP_MUTE, |
| 11806 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11807 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11808 | HDA_AMP_MUTE, |
| 11809 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11810 | if (change) |
| 11811 | alc268_acer_automute(codec, 0); |
| 11812 | return change; |
| 11813 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11814 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11815 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11816 | /* output mixer control */ |
| 11817 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11818 | { |
| 11819 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11820 | .name = "Master Playback Switch", |
| 11821 | .info = snd_hda_mixer_amp_switch_info, |
| 11822 | .get = snd_hda_mixer_amp_switch_get, |
| 11823 | .put = alc268_acer_master_sw_put, |
| 11824 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11825 | }, |
| 11826 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11827 | { } |
| 11828 | }; |
| 11829 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11830 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11831 | /* output mixer control */ |
| 11832 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11833 | { |
| 11834 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11835 | .name = "Master Playback Switch", |
| 11836 | .info = snd_hda_mixer_amp_switch_info, |
| 11837 | .get = snd_hda_mixer_amp_switch_get, |
| 11838 | .put = alc268_acer_master_sw_put, |
| 11839 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11840 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11842 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11843 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11844 | { } |
| 11845 | }; |
| 11846 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11847 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11848 | /* output mixer control */ |
| 11849 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11850 | { |
| 11851 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11852 | .name = "Master Playback Switch", |
| 11853 | .info = snd_hda_mixer_amp_switch_info, |
| 11854 | .get = snd_hda_mixer_amp_switch_get, |
| 11855 | .put = alc268_acer_master_sw_put, |
| 11856 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11857 | }, |
| 11858 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11859 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11860 | { } |
| 11861 | }; |
| 11862 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11863 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11864 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11865 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11866 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11867 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11868 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11869 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11870 | { } |
| 11871 | }; |
| 11872 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11873 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11874 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11875 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11876 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11877 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11878 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11879 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11880 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11881 | { } |
| 11882 | }; |
| 11883 | |
| 11884 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11885 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11886 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11887 | |
| 11888 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11889 | unsigned int res) |
| 11890 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11891 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11892 | return; |
| 11893 | alc268_acer_automute(codec, 1); |
| 11894 | } |
| 11895 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11896 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11897 | { |
| 11898 | alc268_acer_automute(codec, 1); |
| 11899 | } |
| 11900 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11901 | /* toggle speaker-output according to the hp-jack state */ |
| 11902 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11903 | { |
| 11904 | unsigned int present; |
| 11905 | unsigned char bits; |
| 11906 | |
| 11907 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11908 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11909 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11910 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11911 | AMP_IN_MUTE(0), bits); |
| 11912 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11913 | AMP_IN_MUTE(0), bits); |
| 11914 | } |
| 11915 | |
| 11916 | |
| 11917 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11918 | { |
| 11919 | unsigned int present; |
| 11920 | |
| 11921 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11922 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11923 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11924 | present ? 0x0 : 0x6); |
| 11925 | } |
| 11926 | |
| 11927 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11928 | unsigned int res) |
| 11929 | { |
| 11930 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11931 | alc268_aspire_one_speaker_automute(codec); |
| 11932 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11933 | alc268_acer_mic_automute(codec); |
| 11934 | } |
| 11935 | |
| 11936 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11937 | { |
| 11938 | alc268_aspire_one_speaker_automute(codec); |
| 11939 | alc268_acer_mic_automute(codec); |
| 11940 | } |
| 11941 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11942 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11943 | /* output mixer control */ |
| 11944 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11945 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11946 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11947 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11948 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11949 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11950 | { } |
| 11951 | }; |
| 11952 | |
| 11953 | static struct hda_verb alc268_dell_verbs[] = { |
| 11954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11955 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11956 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11957 | { } |
| 11958 | }; |
| 11959 | |
| 11960 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11961 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11962 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11963 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11964 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11965 | spec->autocfg.hp_pins[0] = 0x15; |
| 11966 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11967 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11968 | } |
| 11969 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11970 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11971 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11972 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11973 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11975 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11976 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11977 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11978 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11979 | { } |
| 11980 | }; |
| 11981 | |
| 11982 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11983 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11984 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11985 | { } |
| 11986 | }; |
| 11987 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11988 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11989 | { |
| 11990 | unsigned int present; |
| 11991 | |
| 11992 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11993 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11994 | snd_hda_codec_write(codec, 0x23, 0, |
| 11995 | AC_VERB_SET_CONNECT_SEL, |
| 11996 | present ? 0x00 : 0x01); |
| 11997 | } |
| 11998 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11999 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12000 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12001 | struct alc_spec *spec = codec->spec; |
| 12002 | |
| 12003 | spec->autocfg.hp_pins[0] = 0x15; |
| 12004 | spec->autocfg.speaker_pins[0] = 0x14; |
| 12005 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12006 | alc267_quanta_il1_mic_automute(codec); |
| 12007 | } |
| 12008 | |
| 12009 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 12010 | unsigned int res) |
| 12011 | { |
| 12012 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12013 | case ALC880_MIC_EVENT: |
| 12014 | alc267_quanta_il1_mic_automute(codec); |
| 12015 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12016 | default: |
| 12017 | alc_sku_unsol_event(codec, res); |
| 12018 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12019 | } |
| 12020 | } |
| 12021 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12022 | /* |
| 12023 | * generic initialization of ADC, input mixers and output mixers |
| 12024 | */ |
| 12025 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12026 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12027 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12028 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12029 | |
| 12030 | /* |
| 12031 | * Set up output mixers (0x0c - 0x0e) |
| 12032 | */ |
| 12033 | /* set vol=0 to output mixers */ |
| 12034 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12035 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12036 | |
| 12037 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12038 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12039 | |
| 12040 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12041 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12042 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12043 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12044 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12045 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12046 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12047 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12048 | |
| 12049 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12051 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12052 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12053 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12054 | |
| 12055 | /* set PCBEEP vol = 0, mute connections */ |
| 12056 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12057 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12058 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12059 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12060 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12061 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12062 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12063 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12064 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12065 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12066 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12067 | { } |
| 12068 | }; |
| 12069 | |
| 12070 | /* |
| 12071 | * generic initialization of ADC, input mixers and output mixers |
| 12072 | */ |
| 12073 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12074 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12075 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12076 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12077 | |
| 12078 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12079 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12080 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12081 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12082 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12083 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12084 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12085 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12086 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12087 | |
| 12088 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12089 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12090 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12091 | /* set PCBEEP vol = 0, mute connections */ |
| 12092 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12093 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12094 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12095 | |
| 12096 | { } |
| 12097 | }; |
| 12098 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12099 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12100 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12101 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12102 | { |
| 12103 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12104 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12105 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12106 | */ |
| 12107 | /* .name = "Capture Source", */ |
| 12108 | .name = "Input Source", |
| 12109 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12110 | .info = alc_mux_enum_info, |
| 12111 | .get = alc_mux_enum_get, |
| 12112 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12113 | }, |
| 12114 | { } /* end */ |
| 12115 | }; |
| 12116 | |
| 12117 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12118 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12119 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12120 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12121 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12122 | { |
| 12123 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12124 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12125 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12126 | */ |
| 12127 | /* .name = "Capture Source", */ |
| 12128 | .name = "Input Source", |
| 12129 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12130 | .info = alc_mux_enum_info, |
| 12131 | .get = alc_mux_enum_get, |
| 12132 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12133 | }, |
| 12134 | { } /* end */ |
| 12135 | }; |
| 12136 | |
| 12137 | static struct hda_input_mux alc268_capture_source = { |
| 12138 | .num_items = 4, |
| 12139 | .items = { |
| 12140 | { "Mic", 0x0 }, |
| 12141 | { "Front Mic", 0x1 }, |
| 12142 | { "Line", 0x2 }, |
| 12143 | { "CD", 0x3 }, |
| 12144 | }, |
| 12145 | }; |
| 12146 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12147 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12148 | .num_items = 3, |
| 12149 | .items = { |
| 12150 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12151 | { "Internal Mic", 0x1 }, |
| 12152 | { "Line", 0x2 }, |
| 12153 | }, |
| 12154 | }; |
| 12155 | |
| 12156 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12157 | .num_items = 3, |
| 12158 | .items = { |
| 12159 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12160 | { "Internal Mic", 0x6 }, |
| 12161 | { "Line", 0x2 }, |
| 12162 | }, |
| 12163 | }; |
| 12164 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12165 | #ifdef CONFIG_SND_DEBUG |
| 12166 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12167 | /* Volume widgets */ |
| 12168 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12169 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12170 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12171 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12172 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12173 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12174 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12175 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12176 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12177 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12178 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12179 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12180 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12181 | /* The below appears problematic on some hardwares */ |
| 12182 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12183 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12184 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12185 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12186 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12187 | |
| 12188 | /* Modes for retasking pin widgets */ |
| 12189 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12190 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12191 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12192 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12193 | |
| 12194 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12195 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12196 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12197 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12198 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12199 | |
| 12200 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12201 | * The ALC268 does not have an SPDIF input. |
| 12202 | */ |
| 12203 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12204 | |
| 12205 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12206 | * this output to turn on an external amplifier. |
| 12207 | */ |
| 12208 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12209 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12210 | |
| 12211 | { } /* end */ |
| 12212 | }; |
| 12213 | #endif |
| 12214 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12215 | /* create input playback/capture controls for the given pin */ |
| 12216 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12217 | const char *ctlname, int idx) |
| 12218 | { |
| 12219 | char name[32]; |
| 12220 | int err; |
| 12221 | |
| 12222 | sprintf(name, "%s Playback Volume", ctlname); |
| 12223 | if (nid == 0x14) { |
| 12224 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12225 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 12226 | HDA_OUTPUT)); |
| 12227 | if (err < 0) |
| 12228 | return err; |
| 12229 | } else if (nid == 0x15) { |
| 12230 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12231 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 12232 | HDA_OUTPUT)); |
| 12233 | if (err < 0) |
| 12234 | return err; |
| 12235 | } else |
| 12236 | return -1; |
| 12237 | sprintf(name, "%s Playback Switch", ctlname); |
| 12238 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12239 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 12240 | if (err < 0) |
| 12241 | return err; |
| 12242 | return 0; |
| 12243 | } |
| 12244 | |
| 12245 | /* add playback controls from the parsed DAC table */ |
| 12246 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12247 | const struct auto_pin_cfg *cfg) |
| 12248 | { |
| 12249 | hda_nid_t nid; |
| 12250 | int err; |
| 12251 | |
| 12252 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 12253 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12254 | spec->multiout.dac_nids[0] = 2; |
| 12255 | spec->multiout.dac_nids[1] = 3; |
| 12256 | |
| 12257 | nid = cfg->line_out_pins[0]; |
| 12258 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12259 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12260 | |
| 12261 | nid = cfg->speaker_pins[0]; |
| 12262 | if (nid == 0x1d) { |
| 12263 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12264 | "Speaker Playback Volume", |
| 12265 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12266 | if (err < 0) |
| 12267 | return err; |
| 12268 | } |
| 12269 | nid = cfg->hp_pins[0]; |
| 12270 | if (nid) |
| 12271 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12272 | |
| 12273 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12274 | if (nid == 0x16) { |
| 12275 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12276 | "Mono Playback Switch", |
| 12277 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 12278 | if (err < 0) |
| 12279 | return err; |
| 12280 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12281 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12282 | } |
| 12283 | |
| 12284 | /* create playback/capture controls for input pins */ |
| 12285 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12286 | const struct auto_pin_cfg *cfg) |
| 12287 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12288 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12289 | int i, idx1; |
| 12290 | |
| 12291 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12292 | switch(cfg->input_pins[i]) { |
| 12293 | case 0x18: |
| 12294 | idx1 = 0; /* Mic 1 */ |
| 12295 | break; |
| 12296 | case 0x19: |
| 12297 | idx1 = 1; /* Mic 2 */ |
| 12298 | break; |
| 12299 | case 0x1a: |
| 12300 | idx1 = 2; /* Line In */ |
| 12301 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12302 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12303 | idx1 = 3; /* CD */ |
| 12304 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 12305 | case 0x12: |
| 12306 | case 0x13: |
| 12307 | idx1 = 6; /* digital mics */ |
| 12308 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12309 | default: |
| 12310 | continue; |
| 12311 | } |
| 12312 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 12313 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12314 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12315 | } |
| 12316 | return 0; |
| 12317 | } |
| 12318 | |
| 12319 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12320 | { |
| 12321 | struct alc_spec *spec = codec->spec; |
| 12322 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12323 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12324 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12325 | unsigned int dac_vol1, dac_vol2; |
| 12326 | |
| 12327 | if (speaker_nid) { |
| 12328 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12329 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12330 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12331 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12332 | AMP_IN_UNMUTE(1)); |
| 12333 | snd_hda_codec_write(codec, 0x10, 0, |
| 12334 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12335 | AMP_IN_UNMUTE(1)); |
| 12336 | } else { |
| 12337 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12338 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12339 | snd_hda_codec_write(codec, 0x10, 0, |
| 12340 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12341 | } |
| 12342 | |
| 12343 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12344 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12345 | dac_vol2 = AMP_OUT_ZERO; |
| 12346 | else if (line_nid == 0x15) |
| 12347 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12348 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12349 | dac_vol2 = AMP_OUT_ZERO; |
| 12350 | else if (hp_nid == 0x15) |
| 12351 | dac_vol1 = AMP_OUT_ZERO; |
| 12352 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12353 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12354 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12355 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12356 | |
| 12357 | snd_hda_codec_write(codec, 0x02, 0, |
| 12358 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12359 | snd_hda_codec_write(codec, 0x03, 0, |
| 12360 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12361 | } |
| 12362 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12363 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12364 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12365 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12366 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12367 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12368 | |
| 12369 | /* |
| 12370 | * BIOS auto configuration |
| 12371 | */ |
| 12372 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12373 | { |
| 12374 | struct alc_spec *spec = codec->spec; |
| 12375 | int err; |
| 12376 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12377 | |
| 12378 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12379 | alc268_ignore); |
| 12380 | if (err < 0) |
| 12381 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12382 | if (!spec->autocfg.line_outs) { |
| 12383 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12384 | spec->multiout.max_channels = 2; |
| 12385 | spec->no_analog = 1; |
| 12386 | goto dig_only; |
| 12387 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12388 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12389 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12390 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12391 | if (err < 0) |
| 12392 | return err; |
| 12393 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12394 | if (err < 0) |
| 12395 | return err; |
| 12396 | |
| 12397 | spec->multiout.max_channels = 2; |
| 12398 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12399 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12400 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12401 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12402 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12403 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12404 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12405 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12406 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12407 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12408 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12409 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12410 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12411 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12412 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12413 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12414 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12415 | err = alc_auto_add_mic_boost(codec); |
| 12416 | if (err < 0) |
| 12417 | return err; |
| 12418 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12419 | return 1; |
| 12420 | } |
| 12421 | |
| 12422 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12423 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12424 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12425 | |
| 12426 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12427 | static void alc268_auto_init(struct hda_codec *codec) |
| 12428 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12429 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12430 | alc268_auto_init_multi_out(codec); |
| 12431 | alc268_auto_init_hp_out(codec); |
| 12432 | alc268_auto_init_mono_speaker_out(codec); |
| 12433 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12434 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12435 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12436 | } |
| 12437 | |
| 12438 | /* |
| 12439 | * configuration and preset |
| 12440 | */ |
| 12441 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12442 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12443 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12444 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12445 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12446 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12447 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12448 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12449 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12450 | #ifdef CONFIG_SND_DEBUG |
| 12451 | [ALC268_TEST] = "test", |
| 12452 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12453 | [ALC268_AUTO] = "auto", |
| 12454 | }; |
| 12455 | |
| 12456 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12457 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12458 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12459 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12460 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12461 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12462 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12463 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12464 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12465 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12466 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12467 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12468 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12469 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12470 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12471 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12472 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12473 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12474 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12475 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12476 | {} |
| 12477 | }; |
| 12478 | |
| 12479 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12480 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12481 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12482 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12483 | alc267_quanta_il1_verbs }, |
| 12484 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12485 | .dac_nids = alc268_dac_nids, |
| 12486 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12487 | .adc_nids = alc268_adc_nids_alt, |
| 12488 | .hp_nid = 0x03, |
| 12489 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12490 | .channel_mode = alc268_modes, |
| 12491 | .input_mux = &alc268_capture_source, |
| 12492 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12493 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12494 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12495 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12496 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12497 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12498 | .init_verbs = { alc268_base_init_verbs }, |
| 12499 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12500 | .dac_nids = alc268_dac_nids, |
| 12501 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12502 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12503 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12504 | .hp_nid = 0x03, |
| 12505 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12506 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12507 | .channel_mode = alc268_modes, |
| 12508 | .input_mux = &alc268_capture_source, |
| 12509 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12510 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12511 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12512 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12513 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12514 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12515 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12516 | .dac_nids = alc268_dac_nids, |
| 12517 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12518 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12519 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12520 | .hp_nid = 0x03, |
| 12521 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12522 | .channel_mode = alc268_modes, |
| 12523 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12524 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12525 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12526 | }, |
| 12527 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12528 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12529 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12530 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12531 | alc268_acer_verbs }, |
| 12532 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12533 | .dac_nids = alc268_dac_nids, |
| 12534 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12535 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12536 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12537 | .hp_nid = 0x02, |
| 12538 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12539 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12540 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12541 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12542 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12543 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12544 | [ALC268_ACER_DMIC] = { |
| 12545 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12546 | alc268_beep_mixer }, |
| 12547 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12548 | alc268_acer_verbs }, |
| 12549 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12550 | .dac_nids = alc268_dac_nids, |
| 12551 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12552 | .adc_nids = alc268_adc_nids_alt, |
| 12553 | .capsrc_nids = alc268_capsrc_nids, |
| 12554 | .hp_nid = 0x02, |
| 12555 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12556 | .channel_mode = alc268_modes, |
| 12557 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12558 | .unsol_event = alc268_acer_unsol_event, |
| 12559 | .init_hook = alc268_acer_init_hook, |
| 12560 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12561 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12562 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12563 | alc268_beep_mixer, |
| 12564 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12565 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12566 | alc268_acer_aspire_one_verbs }, |
| 12567 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12568 | .dac_nids = alc268_dac_nids, |
| 12569 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12570 | .adc_nids = alc268_adc_nids_alt, |
| 12571 | .capsrc_nids = alc268_capsrc_nids, |
| 12572 | .hp_nid = 0x03, |
| 12573 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12574 | .channel_mode = alc268_modes, |
| 12575 | .input_mux = &alc268_acer_lc_capture_source, |
| 12576 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12577 | .init_hook = alc268_acer_lc_init_hook, |
| 12578 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12579 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12580 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12581 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12582 | alc268_dell_verbs }, |
| 12583 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12584 | .dac_nids = alc268_dac_nids, |
| 12585 | .hp_nid = 0x02, |
| 12586 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12587 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12588 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12589 | .init_hook = alc268_dell_init_hook, |
| 12590 | .input_mux = &alc268_capture_source, |
| 12591 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12592 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12593 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12594 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12595 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12596 | alc268_toshiba_verbs }, |
| 12597 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12598 | .dac_nids = alc268_dac_nids, |
| 12599 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12600 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12601 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12602 | .hp_nid = 0x03, |
| 12603 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12604 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12605 | .channel_mode = alc268_modes, |
| 12606 | .input_mux = &alc268_capture_source, |
| 12607 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12608 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12609 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12610 | #ifdef CONFIG_SND_DEBUG |
| 12611 | [ALC268_TEST] = { |
| 12612 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12613 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12614 | alc268_volume_init_verbs }, |
| 12615 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12616 | .dac_nids = alc268_dac_nids, |
| 12617 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12618 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12619 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12620 | .hp_nid = 0x03, |
| 12621 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12622 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12623 | .channel_mode = alc268_modes, |
| 12624 | .input_mux = &alc268_capture_source, |
| 12625 | }, |
| 12626 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12627 | }; |
| 12628 | |
| 12629 | static int patch_alc268(struct hda_codec *codec) |
| 12630 | { |
| 12631 | struct alc_spec *spec; |
| 12632 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12633 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12634 | |
| 12635 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12636 | if (spec == NULL) |
| 12637 | return -ENOMEM; |
| 12638 | |
| 12639 | codec->spec = spec; |
| 12640 | |
| 12641 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12642 | alc268_models, |
| 12643 | alc268_cfg_tbl); |
| 12644 | |
| 12645 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 12646 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 12647 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12648 | board_config = ALC268_AUTO; |
| 12649 | } |
| 12650 | |
| 12651 | if (board_config == ALC268_AUTO) { |
| 12652 | /* automatic parse from the BIOS config */ |
| 12653 | err = alc268_parse_auto_config(codec); |
| 12654 | if (err < 0) { |
| 12655 | alc_free(codec); |
| 12656 | return err; |
| 12657 | } else if (!err) { |
| 12658 | printk(KERN_INFO |
| 12659 | "hda_codec: Cannot set up configuration " |
| 12660 | "from BIOS. Using base mode...\n"); |
| 12661 | board_config = ALC268_3ST; |
| 12662 | } |
| 12663 | } |
| 12664 | |
| 12665 | if (board_config != ALC268_AUTO) |
| 12666 | setup_preset(spec, &alc268_presets[board_config]); |
| 12667 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12668 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12669 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12670 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12671 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12672 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12673 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12674 | has_beep = 0; |
| 12675 | for (i = 0; i < spec->num_mixers; i++) { |
| 12676 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12677 | has_beep = 1; |
| 12678 | break; |
| 12679 | } |
| 12680 | } |
| 12681 | |
| 12682 | if (has_beep) { |
| 12683 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12684 | if (err < 0) { |
| 12685 | alc_free(codec); |
| 12686 | return err; |
| 12687 | } |
| 12688 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12689 | /* override the amp caps for beep generator */ |
| 12690 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12691 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12692 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12693 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12694 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12695 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12696 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12697 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12698 | /* check whether NID 0x07 is valid */ |
| 12699 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12700 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12701 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12702 | /* get type */ |
| 12703 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12704 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12705 | spec->adc_nids = alc268_adc_nids_alt; |
| 12706 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12707 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12708 | } else { |
| 12709 | spec->adc_nids = alc268_adc_nids; |
| 12710 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12711 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12712 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12713 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12714 | /* set default input source */ |
| 12715 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12716 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12717 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12718 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12719 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12720 | |
| 12721 | spec->vmaster_nid = 0x02; |
| 12722 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12723 | codec->patch_ops = alc_patch_ops; |
| 12724 | if (board_config == ALC268_AUTO) |
| 12725 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12726 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12727 | codec->proc_widget_hook = print_realtek_coef; |
| 12728 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12729 | return 0; |
| 12730 | } |
| 12731 | |
| 12732 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12733 | * ALC269 channel source setting (2 channel) |
| 12734 | */ |
| 12735 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12736 | |
| 12737 | #define alc269_dac_nids alc260_dac_nids |
| 12738 | |
| 12739 | static hda_nid_t alc269_adc_nids[1] = { |
| 12740 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12741 | 0x08, |
| 12742 | }; |
| 12743 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12744 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12745 | 0x23, |
| 12746 | }; |
| 12747 | |
| 12748 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12749 | * not a mux! |
| 12750 | */ |
| 12751 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12752 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12753 | .num_items = 2, |
| 12754 | .items = { |
| 12755 | { "i-Mic", 0x5 }, |
| 12756 | { "e-Mic", 0x0 }, |
| 12757 | }, |
| 12758 | }; |
| 12759 | |
| 12760 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12761 | .num_items = 2, |
| 12762 | .items = { |
| 12763 | { "i-Mic", 0x1 }, |
| 12764 | { "e-Mic", 0x0 }, |
| 12765 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12766 | }; |
| 12767 | |
| 12768 | #define alc269_modes alc260_modes |
| 12769 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12770 | |
| 12771 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12773 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12774 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12775 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12777 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12778 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12779 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12780 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12781 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12782 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12783 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12784 | { } /* end */ |
| 12785 | }; |
| 12786 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12787 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12788 | /* output mixer control */ |
| 12789 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12790 | { |
| 12791 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12792 | .name = "Master Playback Switch", |
| 12793 | .info = snd_hda_mixer_amp_switch_info, |
| 12794 | .get = snd_hda_mixer_amp_switch_get, |
| 12795 | .put = alc268_acer_master_sw_put, |
| 12796 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12797 | }, |
| 12798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12800 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12801 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12802 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12803 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12804 | { } |
| 12805 | }; |
| 12806 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12807 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12808 | /* output mixer control */ |
| 12809 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12810 | { |
| 12811 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12812 | .name = "Master Playback Switch", |
| 12813 | .info = snd_hda_mixer_amp_switch_info, |
| 12814 | .get = snd_hda_mixer_amp_switch_get, |
| 12815 | .put = alc268_acer_master_sw_put, |
| 12816 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12817 | }, |
| 12818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12819 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12820 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12821 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12822 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12823 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12824 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12825 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12826 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12827 | { } |
| 12828 | }; |
| 12829 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12830 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12831 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12832 | .ops = &snd_hda_bind_vol, |
| 12833 | .values = { |
| 12834 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12835 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12836 | 0 |
| 12837 | }, |
| 12838 | }; |
| 12839 | |
| 12840 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12841 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12842 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12843 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12844 | { } /* end */ |
| 12845 | }; |
| 12846 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12847 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12848 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12849 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12850 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12851 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12852 | { } /* end */ |
| 12853 | }; |
| 12854 | |
| 12855 | /* FSC amilo */ |
| 12856 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12857 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12858 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12859 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12860 | { } /* end */ |
| 12861 | }; |
| 12862 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12863 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12864 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12865 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12866 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12867 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12868 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12869 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12870 | { } |
| 12871 | }; |
| 12872 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12873 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12874 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12875 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12876 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12877 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12878 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12879 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12880 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12881 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12882 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12883 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12884 | { } |
| 12885 | }; |
| 12886 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12887 | /* toggle speaker-output according to the hp-jack state */ |
| 12888 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12889 | { |
| 12890 | unsigned int present; |
| 12891 | unsigned char bits; |
| 12892 | |
| 12893 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12894 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12895 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12896 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12897 | AMP_IN_MUTE(0), bits); |
| 12898 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12899 | AMP_IN_MUTE(0), bits); |
| 12900 | |
| 12901 | snd_hda_codec_write(codec, 0x20, 0, |
| 12902 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12903 | snd_hda_codec_write(codec, 0x20, 0, |
| 12904 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12905 | |
| 12906 | snd_hda_codec_write(codec, 0x20, 0, |
| 12907 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12908 | snd_hda_codec_write(codec, 0x20, 0, |
| 12909 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12910 | } |
| 12911 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12912 | /* toggle speaker-output according to the hp-jacks state */ |
| 12913 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12914 | { |
| 12915 | unsigned int present; |
| 12916 | unsigned char bits; |
| 12917 | |
| 12918 | /* Check laptop headphone socket */ |
| 12919 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12920 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12921 | |
| 12922 | /* Check port replicator headphone socket */ |
| 12923 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12924 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12925 | |
| 12926 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12927 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12928 | AMP_IN_MUTE(0), bits); |
| 12929 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12930 | AMP_IN_MUTE(0), bits); |
| 12931 | |
| 12932 | snd_hda_codec_write(codec, 0x20, 0, |
| 12933 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12934 | snd_hda_codec_write(codec, 0x20, 0, |
| 12935 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12936 | |
| 12937 | snd_hda_codec_write(codec, 0x20, 0, |
| 12938 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12939 | snd_hda_codec_write(codec, 0x20, 0, |
| 12940 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12941 | } |
| 12942 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12943 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12944 | { |
| 12945 | unsigned int present; |
| 12946 | |
| 12947 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12948 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12949 | snd_hda_codec_write(codec, 0x23, 0, |
| 12950 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12951 | } |
| 12952 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12953 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12954 | { |
| 12955 | unsigned int present_laptop; |
| 12956 | unsigned int present_dock; |
| 12957 | |
| 12958 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12959 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12960 | |
| 12961 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12962 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12963 | |
| 12964 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12965 | if (present_dock) |
| 12966 | snd_hda_codec_write(codec, 0x23, 0, |
| 12967 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12968 | if (present_laptop) |
| 12969 | snd_hda_codec_write(codec, 0x23, 0, |
| 12970 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12971 | if (!present_dock && !present_laptop) |
| 12972 | snd_hda_codec_write(codec, 0x23, 0, |
| 12973 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12974 | } |
| 12975 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12976 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12977 | unsigned int res) |
| 12978 | { |
| 12979 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12980 | alc269_quanta_fl1_speaker_automute(codec); |
| 12981 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12982 | alc269_quanta_fl1_mic_automute(codec); |
| 12983 | } |
| 12984 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12985 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12986 | unsigned int res) |
| 12987 | { |
| 12988 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12989 | alc269_lifebook_speaker_automute(codec); |
| 12990 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12991 | alc269_lifebook_mic_autoswitch(codec); |
| 12992 | } |
| 12993 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12994 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12995 | { |
| 12996 | alc269_quanta_fl1_speaker_automute(codec); |
| 12997 | alc269_quanta_fl1_mic_automute(codec); |
| 12998 | } |
| 12999 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13000 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13001 | { |
| 13002 | alc269_lifebook_speaker_automute(codec); |
| 13003 | alc269_lifebook_mic_autoswitch(codec); |
| 13004 | } |
| 13005 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13006 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13007 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13008 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13009 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13010 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13011 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13012 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13013 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13014 | {} |
| 13015 | }; |
| 13016 | |
| 13017 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13018 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13019 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13020 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13021 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13022 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13023 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13024 | {} |
| 13025 | }; |
| 13026 | |
| 13027 | /* toggle speaker-output according to the hp-jack state */ |
| 13028 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13029 | { |
| 13030 | unsigned int present; |
| 13031 | unsigned char bits; |
| 13032 | |
| 13033 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13034 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13035 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13036 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13037 | AMP_IN_MUTE(0), bits); |
| 13038 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13039 | AMP_IN_MUTE(0), bits); |
| 13040 | } |
| 13041 | |
| 13042 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 13043 | { |
| 13044 | unsigned int present; |
| 13045 | |
| 13046 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13047 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13048 | snd_hda_codec_write(codec, 0x23, 0, |
| 13049 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 13050 | } |
| 13051 | |
| 13052 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 13053 | { |
| 13054 | unsigned int present; |
| 13055 | |
| 13056 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13057 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13058 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13059 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13060 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13061 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13062 | } |
| 13063 | |
| 13064 | /* unsolicited event for HP jack sensing */ |
| 13065 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 13066 | unsigned int res) |
| 13067 | { |
| 13068 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13069 | alc269_speaker_automute(codec); |
| 13070 | |
| 13071 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13072 | alc269_eeepc_dmic_automute(codec); |
| 13073 | } |
| 13074 | |
| 13075 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 13076 | { |
| 13077 | alc269_speaker_automute(codec); |
| 13078 | alc269_eeepc_dmic_automute(codec); |
| 13079 | } |
| 13080 | |
| 13081 | /* unsolicited event for HP jack sensing */ |
| 13082 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 13083 | unsigned int res) |
| 13084 | { |
| 13085 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13086 | alc269_speaker_automute(codec); |
| 13087 | |
| 13088 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13089 | alc269_eeepc_amic_automute(codec); |
| 13090 | } |
| 13091 | |
| 13092 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 13093 | { |
| 13094 | alc269_speaker_automute(codec); |
| 13095 | alc269_eeepc_amic_automute(codec); |
| 13096 | } |
| 13097 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13098 | /* |
| 13099 | * generic initialization of ADC, input mixers and output mixers |
| 13100 | */ |
| 13101 | static struct hda_verb alc269_init_verbs[] = { |
| 13102 | /* |
| 13103 | * Unmute ADC0 and set the default input to mic-in |
| 13104 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13106 | |
| 13107 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13108 | * analog-loopback mixer widget |
| 13109 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13110 | * front panel mic (mic 2) |
| 13111 | */ |
| 13112 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13118 | |
| 13119 | /* |
| 13120 | * Set up output mixers (0x0c - 0x0e) |
| 13121 | */ |
| 13122 | /* set vol=0 to output mixers */ |
| 13123 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13124 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13125 | |
| 13126 | /* set up input amps for analog loopback */ |
| 13127 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13128 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13132 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13134 | |
| 13135 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13137 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13138 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13139 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13140 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13141 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13142 | |
| 13143 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13144 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13145 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13146 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13148 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13149 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13150 | |
| 13151 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13152 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13153 | |
| 13154 | /* FIXME: use matrix-type input source selection */ |
| 13155 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13156 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13157 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13158 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13159 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13160 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13161 | |
| 13162 | /* set EAPD */ |
| 13163 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13164 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13165 | { } |
| 13166 | }; |
| 13167 | |
| 13168 | /* add playback controls from the parsed DAC table */ |
| 13169 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13170 | const struct auto_pin_cfg *cfg) |
| 13171 | { |
| 13172 | hda_nid_t nid; |
| 13173 | int err; |
| 13174 | |
| 13175 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 13176 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13177 | spec->multiout.dac_nids[0] = 2; |
| 13178 | |
| 13179 | nid = cfg->line_out_pins[0]; |
| 13180 | if (nid) { |
| 13181 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13182 | "Front Playback Volume", |
| 13183 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 13184 | if (err < 0) |
| 13185 | return err; |
| 13186 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13187 | "Front Playback Switch", |
| 13188 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13189 | if (err < 0) |
| 13190 | return err; |
| 13191 | } |
| 13192 | |
| 13193 | nid = cfg->speaker_pins[0]; |
| 13194 | if (nid) { |
| 13195 | if (!cfg->line_out_pins[0]) { |
| 13196 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13197 | "Speaker Playback Volume", |
| 13198 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13199 | HDA_OUTPUT)); |
| 13200 | if (err < 0) |
| 13201 | return err; |
| 13202 | } |
| 13203 | if (nid == 0x16) { |
| 13204 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13205 | "Speaker Playback Switch", |
| 13206 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13207 | HDA_OUTPUT)); |
| 13208 | if (err < 0) |
| 13209 | return err; |
| 13210 | } else { |
| 13211 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13212 | "Speaker Playback Switch", |
| 13213 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13214 | HDA_OUTPUT)); |
| 13215 | if (err < 0) |
| 13216 | return err; |
| 13217 | } |
| 13218 | } |
| 13219 | nid = cfg->hp_pins[0]; |
| 13220 | if (nid) { |
| 13221 | /* spec->multiout.hp_nid = 2; */ |
| 13222 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 13223 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13224 | "Headphone Playback Volume", |
| 13225 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13226 | HDA_OUTPUT)); |
| 13227 | if (err < 0) |
| 13228 | return err; |
| 13229 | } |
| 13230 | if (nid == 0x16) { |
| 13231 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13232 | "Headphone Playback Switch", |
| 13233 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13234 | HDA_OUTPUT)); |
| 13235 | if (err < 0) |
| 13236 | return err; |
| 13237 | } else { |
| 13238 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13239 | "Headphone Playback Switch", |
| 13240 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13241 | HDA_OUTPUT)); |
| 13242 | if (err < 0) |
| 13243 | return err; |
| 13244 | } |
| 13245 | } |
| 13246 | return 0; |
| 13247 | } |
| 13248 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 13249 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13250 | const struct auto_pin_cfg *cfg) |
| 13251 | { |
| 13252 | int err; |
| 13253 | |
| 13254 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 13255 | if (err < 0) |
| 13256 | return err; |
| 13257 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 13258 | * because it's under 0x18 |
| 13259 | */ |
| 13260 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 13261 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13262 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 13263 | imux->items[imux->num_items].label = "Int Mic"; |
| 13264 | imux->items[imux->num_items].index = 0x05; |
| 13265 | imux->num_items++; |
| 13266 | } |
| 13267 | return 0; |
| 13268 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13269 | |
| 13270 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13271 | #define alc269_loopbacks alc880_loopbacks |
| 13272 | #endif |
| 13273 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13274 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13275 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13276 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13277 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13278 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13279 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13280 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13281 | .substreams = 1, |
| 13282 | .channels_min = 2, |
| 13283 | .channels_max = 8, |
| 13284 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13285 | /* NID is set in alc_build_pcms */ |
| 13286 | .ops = { |
| 13287 | .open = alc880_playback_pcm_open, |
| 13288 | .prepare = alc880_playback_pcm_prepare, |
| 13289 | .cleanup = alc880_playback_pcm_cleanup |
| 13290 | }, |
| 13291 | }; |
| 13292 | |
| 13293 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13294 | .substreams = 1, |
| 13295 | .channels_min = 2, |
| 13296 | .channels_max = 2, |
| 13297 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13298 | /* NID is set in alc_build_pcms */ |
| 13299 | }; |
| 13300 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13301 | /* |
| 13302 | * BIOS auto configuration |
| 13303 | */ |
| 13304 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13305 | { |
| 13306 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13307 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13308 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13309 | |
| 13310 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13311 | alc269_ignore); |
| 13312 | if (err < 0) |
| 13313 | return err; |
| 13314 | |
| 13315 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13316 | if (err < 0) |
| 13317 | return err; |
| 13318 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13319 | if (err < 0) |
| 13320 | return err; |
| 13321 | |
| 13322 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13323 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13324 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13325 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13326 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13327 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13328 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13329 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13330 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13331 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13332 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13333 | /* set default input source */ |
| 13334 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13335 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13336 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13337 | |
| 13338 | err = alc_auto_add_mic_boost(codec); |
| 13339 | if (err < 0) |
| 13340 | return err; |
| 13341 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13342 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13343 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13344 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13345 | return 1; |
| 13346 | } |
| 13347 | |
| 13348 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13349 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13350 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13351 | |
| 13352 | |
| 13353 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13354 | static void alc269_auto_init(struct hda_codec *codec) |
| 13355 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13356 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13357 | alc269_auto_init_multi_out(codec); |
| 13358 | alc269_auto_init_hp_out(codec); |
| 13359 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13360 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13361 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13362 | } |
| 13363 | |
| 13364 | /* |
| 13365 | * configuration and preset |
| 13366 | */ |
| 13367 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13368 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13369 | [ALC269_QUANTA_FL1] = "quanta", |
| 13370 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13371 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13372 | [ALC269_FUJITSU] = "fujitsu", |
| 13373 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13374 | }; |
| 13375 | |
| 13376 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13377 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13378 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13379 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13380 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13381 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13382 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13383 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13384 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13385 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13386 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13387 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13388 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13389 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13390 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13391 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13392 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13393 | {} |
| 13394 | }; |
| 13395 | |
| 13396 | static struct alc_config_preset alc269_presets[] = { |
| 13397 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13398 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13399 | .init_verbs = { alc269_init_verbs }, |
| 13400 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13401 | .dac_nids = alc269_dac_nids, |
| 13402 | .hp_nid = 0x03, |
| 13403 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13404 | .channel_mode = alc269_modes, |
| 13405 | .input_mux = &alc269_capture_source, |
| 13406 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13407 | [ALC269_QUANTA_FL1] = { |
| 13408 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13409 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13410 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13411 | .dac_nids = alc269_dac_nids, |
| 13412 | .hp_nid = 0x03, |
| 13413 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13414 | .channel_mode = alc269_modes, |
| 13415 | .input_mux = &alc269_capture_source, |
| 13416 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13417 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13418 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13419 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13420 | .mixers = { alc269_eeepc_mixer }, |
| 13421 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13422 | .init_verbs = { alc269_init_verbs, |
| 13423 | alc269_eeepc_amic_init_verbs }, |
| 13424 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13425 | .dac_nids = alc269_dac_nids, |
| 13426 | .hp_nid = 0x03, |
| 13427 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13428 | .channel_mode = alc269_modes, |
| 13429 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13430 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13431 | .init_hook = alc269_eeepc_amic_inithook, |
| 13432 | }, |
| 13433 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13434 | .mixers = { alc269_eeepc_mixer }, |
| 13435 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13436 | .init_verbs = { alc269_init_verbs, |
| 13437 | alc269_eeepc_dmic_init_verbs }, |
| 13438 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13439 | .dac_nids = alc269_dac_nids, |
| 13440 | .hp_nid = 0x03, |
| 13441 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13442 | .channel_mode = alc269_modes, |
| 13443 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13444 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13445 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13446 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13447 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13448 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13449 | .cap_mixer = alc269_epc_capture_mixer, |
| 13450 | .init_verbs = { alc269_init_verbs, |
| 13451 | alc269_eeepc_dmic_init_verbs }, |
| 13452 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13453 | .dac_nids = alc269_dac_nids, |
| 13454 | .hp_nid = 0x03, |
| 13455 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13456 | .channel_mode = alc269_modes, |
| 13457 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13458 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13459 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13460 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13461 | [ALC269_LIFEBOOK] = { |
| 13462 | .mixers = { alc269_lifebook_mixer }, |
| 13463 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13464 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13465 | .dac_nids = alc269_dac_nids, |
| 13466 | .hp_nid = 0x03, |
| 13467 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13468 | .channel_mode = alc269_modes, |
| 13469 | .input_mux = &alc269_capture_source, |
| 13470 | .unsol_event = alc269_lifebook_unsol_event, |
| 13471 | .init_hook = alc269_lifebook_init_hook, |
| 13472 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13473 | }; |
| 13474 | |
| 13475 | static int patch_alc269(struct hda_codec *codec) |
| 13476 | { |
| 13477 | struct alc_spec *spec; |
| 13478 | int board_config; |
| 13479 | int err; |
| 13480 | |
| 13481 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13482 | if (spec == NULL) |
| 13483 | return -ENOMEM; |
| 13484 | |
| 13485 | codec->spec = spec; |
| 13486 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13487 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13488 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13489 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13490 | alc269_models, |
| 13491 | alc269_cfg_tbl); |
| 13492 | |
| 13493 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 13494 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 13495 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13496 | board_config = ALC269_AUTO; |
| 13497 | } |
| 13498 | |
| 13499 | if (board_config == ALC269_AUTO) { |
| 13500 | /* automatic parse from the BIOS config */ |
| 13501 | err = alc269_parse_auto_config(codec); |
| 13502 | if (err < 0) { |
| 13503 | alc_free(codec); |
| 13504 | return err; |
| 13505 | } else if (!err) { |
| 13506 | printk(KERN_INFO |
| 13507 | "hda_codec: Cannot set up configuration " |
| 13508 | "from BIOS. Using base mode...\n"); |
| 13509 | board_config = ALC269_BASIC; |
| 13510 | } |
| 13511 | } |
| 13512 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13513 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13514 | if (err < 0) { |
| 13515 | alc_free(codec); |
| 13516 | return err; |
| 13517 | } |
| 13518 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13519 | if (board_config != ALC269_AUTO) |
| 13520 | setup_preset(spec, &alc269_presets[board_config]); |
| 13521 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13522 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13523 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13524 | * fix the sample rate of analog I/O to 44.1kHz |
| 13525 | */ |
| 13526 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13527 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13528 | } else { |
| 13529 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13530 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13531 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13532 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13533 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13534 | |
| 13535 | spec->adc_nids = alc269_adc_nids; |
| 13536 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13537 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13538 | if (!spec->cap_mixer) |
| 13539 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13540 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13541 | |
| 13542 | codec->patch_ops = alc_patch_ops; |
| 13543 | if (board_config == ALC269_AUTO) |
| 13544 | spec->init_hook = alc269_auto_init; |
| 13545 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13546 | if (!spec->loopback.amplist) |
| 13547 | spec->loopback.amplist = alc269_loopbacks; |
| 13548 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13549 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13550 | |
| 13551 | return 0; |
| 13552 | } |
| 13553 | |
| 13554 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13555 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13556 | */ |
| 13557 | |
| 13558 | /* |
| 13559 | * set the path ways for 2 channel output |
| 13560 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13561 | */ |
| 13562 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13563 | /* set pin widget 1Ah (line in) for input */ |
| 13564 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13565 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13566 | * the vref |
| 13567 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13568 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13569 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13570 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13571 | #if 0 |
| 13572 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13573 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13574 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13575 | { } /* end */ |
| 13576 | }; |
| 13577 | /* |
| 13578 | * 6ch mode |
| 13579 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13580 | */ |
| 13581 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13582 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13583 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13584 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13585 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13586 | |
| 13587 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13588 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13589 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13590 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13591 | #if 0 |
| 13592 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13593 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13594 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13595 | { } /* end */ |
| 13596 | }; |
| 13597 | |
| 13598 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13599 | { 2, alc861_threestack_ch2_init }, |
| 13600 | { 6, alc861_threestack_ch6_init }, |
| 13601 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13602 | /* Set mic1 as input and unmute the mixer */ |
| 13603 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13604 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13605 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13606 | { } /* end */ |
| 13607 | }; |
| 13608 | /* Set mic1 as output and mute mixer */ |
| 13609 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13610 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13611 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13612 | { } /* end */ |
| 13613 | }; |
| 13614 | |
| 13615 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13616 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13617 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13618 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13619 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13620 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13621 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13622 | /* set pin widget 1Ah (line in) for input */ |
| 13623 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13624 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13625 | * the vref |
| 13626 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13627 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13628 | |
| 13629 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13630 | #if 0 |
| 13631 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13632 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13633 | #endif |
| 13634 | { } /* end */ |
| 13635 | }; |
| 13636 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13637 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13638 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13639 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13640 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13641 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13642 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13643 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13644 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13645 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13646 | |
| 13647 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13648 | #if 0 |
| 13649 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13650 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13651 | #endif |
| 13652 | { } /* end */ |
| 13653 | }; |
| 13654 | |
| 13655 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13656 | { 2, alc861_asus_ch2_init }, |
| 13657 | { 6, alc861_asus_ch6_init }, |
| 13658 | }; |
| 13659 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13660 | /* patch-ALC861 */ |
| 13661 | |
| 13662 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13663 | /* output mixer control */ |
| 13664 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13665 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13666 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13667 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13668 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13669 | |
| 13670 | /*Input mixer control */ |
| 13671 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13672 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13673 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13674 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13676 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13678 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13679 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13680 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13681 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13682 | { } /* end */ |
| 13683 | }; |
| 13684 | |
| 13685 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13686 | /* output mixer control */ |
| 13687 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13688 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13689 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13690 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13691 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13692 | |
| 13693 | /* Input mixer control */ |
| 13694 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13695 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13696 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13697 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13698 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13699 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13700 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13701 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13702 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13703 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13704 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13705 | { |
| 13706 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13707 | .name = "Channel Mode", |
| 13708 | .info = alc_ch_mode_info, |
| 13709 | .get = alc_ch_mode_get, |
| 13710 | .put = alc_ch_mode_put, |
| 13711 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13712 | }, |
| 13713 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13714 | }; |
| 13715 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13716 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13717 | /* output mixer control */ |
| 13718 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13721 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13722 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13723 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13724 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13725 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13726 | /* output mixer control */ |
| 13727 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13728 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13729 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13730 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13731 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13732 | |
| 13733 | /* Input mixer control */ |
| 13734 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13735 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13736 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13737 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13738 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13739 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13740 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13741 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13742 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13743 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13744 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13745 | { |
| 13746 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13747 | .name = "Channel Mode", |
| 13748 | .info = alc_ch_mode_info, |
| 13749 | .get = alc_ch_mode_get, |
| 13750 | .put = alc_ch_mode_put, |
| 13751 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13752 | }, |
| 13753 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13754 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13755 | |
| 13756 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13757 | /* output mixer control */ |
| 13758 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13759 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13760 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13761 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13762 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13763 | |
| 13764 | /* Input mixer control */ |
| 13765 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13766 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13767 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13768 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13769 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13770 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13772 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13773 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13774 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13775 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13776 | { |
| 13777 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13778 | .name = "Channel Mode", |
| 13779 | .info = alc_ch_mode_info, |
| 13780 | .get = alc_ch_mode_get, |
| 13781 | .put = alc_ch_mode_put, |
| 13782 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13783 | }, |
| 13784 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13785 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13786 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13787 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13788 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13789 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13790 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13791 | { } |
| 13792 | }; |
| 13793 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13794 | /* |
| 13795 | * generic initialization of ADC, input mixers and output mixers |
| 13796 | */ |
| 13797 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13798 | /* |
| 13799 | * Unmute ADC0 and set the default input to mic-in |
| 13800 | */ |
| 13801 | /* port-A for surround (rear panel) */ |
| 13802 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13803 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13804 | /* port-B for mic-in (rear panel) with vref */ |
| 13805 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13806 | /* port-C for line-in (rear panel) */ |
| 13807 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13808 | /* port-D for Front */ |
| 13809 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13810 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13811 | /* port-E for HP out (front panel) */ |
| 13812 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13813 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13814 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13815 | /* port-F for mic-in (front panel) with vref */ |
| 13816 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13817 | /* port-G for CLFE (rear panel) */ |
| 13818 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13819 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13820 | /* port-H for side (rear panel) */ |
| 13821 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13822 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13823 | /* CD-in */ |
| 13824 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13825 | /* route front mic to ADC1*/ |
| 13826 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13827 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13828 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13829 | /* Unmute DAC0~3 & spdif out*/ |
| 13830 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13831 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13832 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13833 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13834 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13835 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13836 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13837 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13838 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13839 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13840 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13841 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13842 | /* Unmute Stereo Mixer 15 */ |
| 13843 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13845 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13846 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13847 | |
| 13848 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13849 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13850 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13851 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13852 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13853 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13854 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13855 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13856 | /* hp used DAC 3 (Front) */ |
| 13857 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13858 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13859 | |
| 13860 | { } |
| 13861 | }; |
| 13862 | |
| 13863 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13864 | /* |
| 13865 | * Unmute ADC0 and set the default input to mic-in |
| 13866 | */ |
| 13867 | /* port-A for surround (rear panel) */ |
| 13868 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13869 | /* port-B for mic-in (rear panel) with vref */ |
| 13870 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13871 | /* port-C for line-in (rear panel) */ |
| 13872 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13873 | /* port-D for Front */ |
| 13874 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13875 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13876 | /* port-E for HP out (front panel) */ |
| 13877 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13878 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13879 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13880 | /* port-F for mic-in (front panel) with vref */ |
| 13881 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13882 | /* port-G for CLFE (rear panel) */ |
| 13883 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13884 | /* port-H for side (rear panel) */ |
| 13885 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13886 | /* CD-in */ |
| 13887 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13888 | /* route front mic to ADC1*/ |
| 13889 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13890 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13891 | /* Unmute DAC0~3 & spdif out*/ |
| 13892 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13893 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13894 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13895 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13897 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13898 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13899 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13900 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13901 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13902 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13904 | /* Unmute Stereo Mixer 15 */ |
| 13905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13906 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13907 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13908 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13909 | |
| 13910 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13911 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13912 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13913 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13914 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13915 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13916 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13917 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13918 | /* hp used DAC 3 (Front) */ |
| 13919 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13920 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13921 | { } |
| 13922 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13923 | |
| 13924 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13925 | /* |
| 13926 | * Unmute ADC0 and set the default input to mic-in |
| 13927 | */ |
| 13928 | /* port-A for surround (rear panel) */ |
| 13929 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13930 | /* port-B for mic-in (rear panel) with vref */ |
| 13931 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13932 | /* port-C for line-in (rear panel) */ |
| 13933 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13934 | /* port-D for Front */ |
| 13935 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13936 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13937 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13938 | /* this has to be set to VREF80 */ |
| 13939 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13940 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13941 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13942 | /* port-F for mic-in (front panel) with vref */ |
| 13943 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13944 | /* port-G for CLFE (rear panel) */ |
| 13945 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13946 | /* port-H for side (rear panel) */ |
| 13947 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13948 | /* CD-in */ |
| 13949 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13950 | /* route front mic to ADC1*/ |
| 13951 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13952 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13953 | /* Unmute DAC0~3 & spdif out*/ |
| 13954 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13955 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13956 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13957 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13958 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13959 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13960 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13961 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13962 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13963 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13964 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13965 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13966 | /* Unmute Stereo Mixer 15 */ |
| 13967 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13968 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13970 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13971 | |
| 13972 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13973 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13974 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13975 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13976 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13977 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13978 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13979 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13980 | /* hp used DAC 3 (Front) */ |
| 13981 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13982 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13983 | { } |
| 13984 | }; |
| 13985 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13986 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13987 | /* |
| 13988 | * Unmute ADC0 and set the default input to mic-in |
| 13989 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13990 | /* port-A for surround (rear panel) |
| 13991 | * according to codec#0 this is the HP jack |
| 13992 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13993 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13994 | /* route front PCM to HP */ |
| 13995 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13996 | /* port-B for mic-in (rear panel) with vref */ |
| 13997 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13998 | /* port-C for line-in (rear panel) */ |
| 13999 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14000 | /* port-D for Front */ |
| 14001 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14002 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14003 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14004 | /* this has to be set to VREF80 */ |
| 14005 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14006 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14007 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14008 | /* port-F for mic-in (front panel) with vref */ |
| 14009 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14010 | /* port-G for CLFE (rear panel) */ |
| 14011 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14012 | /* port-H for side (rear panel) */ |
| 14013 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14014 | /* CD-in */ |
| 14015 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14016 | /* route front mic to ADC1*/ |
| 14017 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14018 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14019 | /* Unmute DAC0~3 & spdif out*/ |
| 14020 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14021 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14022 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14023 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14025 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14026 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14027 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14028 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14029 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14030 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14031 | /* Unmute Stereo Mixer 15 */ |
| 14032 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14033 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14034 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14035 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14036 | |
| 14037 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14038 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14039 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14040 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14041 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14042 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14043 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14044 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14045 | /* hp used DAC 3 (Front) */ |
| 14046 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14047 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14048 | { } |
| 14049 | }; |
| 14050 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14051 | /* additional init verbs for ASUS laptops */ |
| 14052 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14053 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14054 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14055 | { } |
| 14056 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14057 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14058 | /* |
| 14059 | * generic initialization of ADC, input mixers and output mixers |
| 14060 | */ |
| 14061 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14062 | /* |
| 14063 | * Unmute ADC0 and set the default input to mic-in |
| 14064 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14065 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14066 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14067 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14068 | /* Unmute DAC0~3 & spdif out*/ |
| 14069 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14070 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14071 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14072 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14073 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14074 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14075 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14076 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14077 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14078 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14079 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14080 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14081 | /* Unmute Stereo Mixer 15 */ |
| 14082 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14083 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14084 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14085 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14086 | |
| 14087 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14088 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14089 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14090 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14091 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14092 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14093 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14094 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14095 | |
| 14096 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14097 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14098 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14099 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14100 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14101 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14102 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14103 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14104 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14105 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14106 | |
| 14107 | { } |
| 14108 | }; |
| 14109 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14110 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14111 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14112 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14113 | { } |
| 14114 | }; |
| 14115 | |
| 14116 | /* toggle speaker-output according to the hp-jack state */ |
| 14117 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14118 | { |
| 14119 | unsigned int present; |
| 14120 | |
| 14121 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 14122 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14123 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14124 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14125 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14126 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14127 | } |
| 14128 | |
| 14129 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14130 | unsigned int res) |
| 14131 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14132 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14133 | alc861_toshiba_automute(codec); |
| 14134 | } |
| 14135 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14136 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14137 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14138 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14139 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14140 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14141 | |
| 14142 | |
| 14143 | #define ALC861_DIGOUT_NID 0x07 |
| 14144 | |
| 14145 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14146 | { 8, NULL } |
| 14147 | }; |
| 14148 | |
| 14149 | static hda_nid_t alc861_dac_nids[4] = { |
| 14150 | /* front, surround, clfe, side */ |
| 14151 | 0x03, 0x06, 0x05, 0x04 |
| 14152 | }; |
| 14153 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14154 | static hda_nid_t alc660_dac_nids[3] = { |
| 14155 | /* front, clfe, surround */ |
| 14156 | 0x03, 0x05, 0x06 |
| 14157 | }; |
| 14158 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14159 | static hda_nid_t alc861_adc_nids[1] = { |
| 14160 | /* ADC0-2 */ |
| 14161 | 0x08, |
| 14162 | }; |
| 14163 | |
| 14164 | static struct hda_input_mux alc861_capture_source = { |
| 14165 | .num_items = 5, |
| 14166 | .items = { |
| 14167 | { "Mic", 0x0 }, |
| 14168 | { "Front Mic", 0x3 }, |
| 14169 | { "Line", 0x1 }, |
| 14170 | { "CD", 0x4 }, |
| 14171 | { "Mixer", 0x5 }, |
| 14172 | }, |
| 14173 | }; |
| 14174 | |
| 14175 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14176 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 14177 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14178 | { |
| 14179 | int i; |
| 14180 | hda_nid_t nid; |
| 14181 | |
| 14182 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14183 | for (i = 0; i < cfg->line_outs; i++) { |
| 14184 | nid = cfg->line_out_pins[i]; |
| 14185 | if (nid) { |
| 14186 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 14187 | continue; |
| 14188 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 14189 | } |
| 14190 | } |
| 14191 | spec->multiout.num_dacs = cfg->line_outs; |
| 14192 | return 0; |
| 14193 | } |
| 14194 | |
| 14195 | /* add playback controls from the parsed DAC table */ |
| 14196 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14197 | const struct auto_pin_cfg *cfg) |
| 14198 | { |
| 14199 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14200 | static const char *chname[4] = { |
| 14201 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14202 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14203 | hda_nid_t nid; |
| 14204 | int i, idx, err; |
| 14205 | |
| 14206 | for (i = 0; i < cfg->line_outs; i++) { |
| 14207 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14208 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14209 | continue; |
| 14210 | if (nid == 0x05) { |
| 14211 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14212 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14213 | "Center Playback Switch", |
| 14214 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14215 | HDA_OUTPUT)); |
| 14216 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14217 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14218 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14219 | "LFE Playback Switch", |
| 14220 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14221 | HDA_OUTPUT)); |
| 14222 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14223 | return err; |
| 14224 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14225 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 14226 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14227 | if (nid == alc861_dac_nids[idx]) |
| 14228 | break; |
| 14229 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14230 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14231 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14232 | HDA_OUTPUT)); |
| 14233 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14234 | return err; |
| 14235 | } |
| 14236 | } |
| 14237 | return 0; |
| 14238 | } |
| 14239 | |
| 14240 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 14241 | { |
| 14242 | int err; |
| 14243 | hda_nid_t nid; |
| 14244 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14245 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14246 | return 0; |
| 14247 | |
| 14248 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 14249 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14250 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 14251 | "Headphone Playback Switch", |
| 14252 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14253 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14254 | return err; |
| 14255 | spec->multiout.hp_nid = nid; |
| 14256 | } |
| 14257 | return 0; |
| 14258 | } |
| 14259 | |
| 14260 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14261 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 14262 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14263 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14264 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14265 | int i, err, idx, idx1; |
| 14266 | |
| 14267 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14268 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14269 | case 0x0c: |
| 14270 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14271 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14272 | break; |
| 14273 | case 0x0f: |
| 14274 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14275 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14276 | break; |
| 14277 | case 0x0d: |
| 14278 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14279 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14280 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14281 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14282 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14283 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14284 | break; |
| 14285 | case 0x11: |
| 14286 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14287 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14288 | break; |
| 14289 | default: |
| 14290 | continue; |
| 14291 | } |
| 14292 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14293 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14294 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14295 | if (err < 0) |
| 14296 | return err; |
| 14297 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14298 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14299 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14300 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14301 | } |
| 14302 | return 0; |
| 14303 | } |
| 14304 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14305 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14306 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14307 | int pin_type, int dac_idx) |
| 14308 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14309 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14310 | pin_type); |
| 14311 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14312 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14313 | } |
| 14314 | |
| 14315 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14316 | { |
| 14317 | struct alc_spec *spec = codec->spec; |
| 14318 | int i; |
| 14319 | |
| 14320 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14321 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14322 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14323 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14324 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14325 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14326 | } |
| 14327 | } |
| 14328 | |
| 14329 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14330 | { |
| 14331 | struct alc_spec *spec = codec->spec; |
| 14332 | hda_nid_t pin; |
| 14333 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14334 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14335 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14336 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 14337 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14338 | pin = spec->autocfg.speaker_pins[0]; |
| 14339 | if (pin) |
| 14340 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14341 | } |
| 14342 | |
| 14343 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14344 | { |
| 14345 | struct alc_spec *spec = codec->spec; |
| 14346 | int i; |
| 14347 | |
| 14348 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14349 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14350 | if (nid >= 0x0c && nid <= 0x11) |
| 14351 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14352 | } |
| 14353 | } |
| 14354 | |
| 14355 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14356 | /* return 1 if successful, 0 if the proper config is not found, |
| 14357 | * or a negative error code |
| 14358 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14359 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14360 | { |
| 14361 | struct alc_spec *spec = codec->spec; |
| 14362 | int err; |
| 14363 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14364 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14365 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14366 | alc861_ignore); |
| 14367 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14368 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14369 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14370 | return 0; /* can't find valid BIOS pin config */ |
| 14371 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14372 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14373 | if (err < 0) |
| 14374 | return err; |
| 14375 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14376 | if (err < 0) |
| 14377 | return err; |
| 14378 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 14379 | if (err < 0) |
| 14380 | return err; |
| 14381 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14382 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14383 | return err; |
| 14384 | |
| 14385 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14386 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14387 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14388 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14389 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14390 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14391 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14392 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14393 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14394 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14395 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14396 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14397 | |
| 14398 | spec->adc_nids = alc861_adc_nids; |
| 14399 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14400 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14401 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14402 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14403 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14404 | return 1; |
| 14405 | } |
| 14406 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14407 | /* additional initialization for auto-configuration model */ |
| 14408 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14409 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14410 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14411 | alc861_auto_init_multi_out(codec); |
| 14412 | alc861_auto_init_hp_out(codec); |
| 14413 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14414 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14415 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14416 | } |
| 14417 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14418 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14419 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14420 | { 0x15, HDA_INPUT, 0 }, |
| 14421 | { 0x15, HDA_INPUT, 1 }, |
| 14422 | { 0x15, HDA_INPUT, 2 }, |
| 14423 | { 0x15, HDA_INPUT, 3 }, |
| 14424 | { } /* end */ |
| 14425 | }; |
| 14426 | #endif |
| 14427 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14428 | |
| 14429 | /* |
| 14430 | * configuration and preset |
| 14431 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14432 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14433 | [ALC861_3ST] = "3stack", |
| 14434 | [ALC660_3ST] = "3stack-660", |
| 14435 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14436 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14437 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14438 | [ALC861_TOSHIBA] = "toshiba", |
| 14439 | [ALC861_ASUS] = "asus", |
| 14440 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14441 | [ALC861_AUTO] = "auto", |
| 14442 | }; |
| 14443 | |
| 14444 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14445 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14446 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14447 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14448 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14449 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14450 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14451 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14452 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14453 | * Any other models that need this preset? |
| 14454 | */ |
| 14455 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14456 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14457 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14458 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14459 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14460 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14461 | /* FIXME: the below seems conflict */ |
| 14462 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14463 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14464 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14465 | {} |
| 14466 | }; |
| 14467 | |
| 14468 | static struct alc_config_preset alc861_presets[] = { |
| 14469 | [ALC861_3ST] = { |
| 14470 | .mixers = { alc861_3ST_mixer }, |
| 14471 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14472 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14473 | .dac_nids = alc861_dac_nids, |
| 14474 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14475 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14476 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14477 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14478 | .adc_nids = alc861_adc_nids, |
| 14479 | .input_mux = &alc861_capture_source, |
| 14480 | }, |
| 14481 | [ALC861_3ST_DIG] = { |
| 14482 | .mixers = { alc861_base_mixer }, |
| 14483 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14484 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14485 | .dac_nids = alc861_dac_nids, |
| 14486 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14487 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14488 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14489 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14490 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14491 | .adc_nids = alc861_adc_nids, |
| 14492 | .input_mux = &alc861_capture_source, |
| 14493 | }, |
| 14494 | [ALC861_6ST_DIG] = { |
| 14495 | .mixers = { alc861_base_mixer }, |
| 14496 | .init_verbs = { alc861_base_init_verbs }, |
| 14497 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14498 | .dac_nids = alc861_dac_nids, |
| 14499 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14500 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14501 | .channel_mode = alc861_8ch_modes, |
| 14502 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14503 | .adc_nids = alc861_adc_nids, |
| 14504 | .input_mux = &alc861_capture_source, |
| 14505 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14506 | [ALC660_3ST] = { |
| 14507 | .mixers = { alc861_3ST_mixer }, |
| 14508 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14509 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14510 | .dac_nids = alc660_dac_nids, |
| 14511 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14512 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14513 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14514 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14515 | .adc_nids = alc861_adc_nids, |
| 14516 | .input_mux = &alc861_capture_source, |
| 14517 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14518 | [ALC861_UNIWILL_M31] = { |
| 14519 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14520 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14521 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14522 | .dac_nids = alc861_dac_nids, |
| 14523 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14524 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14525 | .channel_mode = alc861_uniwill_m31_modes, |
| 14526 | .need_dac_fix = 1, |
| 14527 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14528 | .adc_nids = alc861_adc_nids, |
| 14529 | .input_mux = &alc861_capture_source, |
| 14530 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14531 | [ALC861_TOSHIBA] = { |
| 14532 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14533 | .init_verbs = { alc861_base_init_verbs, |
| 14534 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14535 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14536 | .dac_nids = alc861_dac_nids, |
| 14537 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14538 | .channel_mode = alc883_3ST_2ch_modes, |
| 14539 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14540 | .adc_nids = alc861_adc_nids, |
| 14541 | .input_mux = &alc861_capture_source, |
| 14542 | .unsol_event = alc861_toshiba_unsol_event, |
| 14543 | .init_hook = alc861_toshiba_automute, |
| 14544 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14545 | [ALC861_ASUS] = { |
| 14546 | .mixers = { alc861_asus_mixer }, |
| 14547 | .init_verbs = { alc861_asus_init_verbs }, |
| 14548 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14549 | .dac_nids = alc861_dac_nids, |
| 14550 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14551 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14552 | .channel_mode = alc861_asus_modes, |
| 14553 | .need_dac_fix = 1, |
| 14554 | .hp_nid = 0x06, |
| 14555 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14556 | .adc_nids = alc861_adc_nids, |
| 14557 | .input_mux = &alc861_capture_source, |
| 14558 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14559 | [ALC861_ASUS_LAPTOP] = { |
| 14560 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14561 | .init_verbs = { alc861_asus_init_verbs, |
| 14562 | alc861_asus_laptop_init_verbs }, |
| 14563 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14564 | .dac_nids = alc861_dac_nids, |
| 14565 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14566 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14567 | .channel_mode = alc883_3ST_2ch_modes, |
| 14568 | .need_dac_fix = 1, |
| 14569 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14570 | .adc_nids = alc861_adc_nids, |
| 14571 | .input_mux = &alc861_capture_source, |
| 14572 | }, |
| 14573 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14574 | |
| 14575 | |
| 14576 | static int patch_alc861(struct hda_codec *codec) |
| 14577 | { |
| 14578 | struct alc_spec *spec; |
| 14579 | int board_config; |
| 14580 | int err; |
| 14581 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14582 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14583 | if (spec == NULL) |
| 14584 | return -ENOMEM; |
| 14585 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14586 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14587 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14588 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14589 | alc861_models, |
| 14590 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14591 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14592 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 14593 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 14594 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14595 | board_config = ALC861_AUTO; |
| 14596 | } |
| 14597 | |
| 14598 | if (board_config == ALC861_AUTO) { |
| 14599 | /* automatic parse from the BIOS config */ |
| 14600 | err = alc861_parse_auto_config(codec); |
| 14601 | if (err < 0) { |
| 14602 | alc_free(codec); |
| 14603 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14604 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14605 | printk(KERN_INFO |
| 14606 | "hda_codec: Cannot set up configuration " |
| 14607 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14608 | board_config = ALC861_3ST_DIG; |
| 14609 | } |
| 14610 | } |
| 14611 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14612 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14613 | if (err < 0) { |
| 14614 | alc_free(codec); |
| 14615 | return err; |
| 14616 | } |
| 14617 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14618 | if (board_config != ALC861_AUTO) |
| 14619 | setup_preset(spec, &alc861_presets[board_config]); |
| 14620 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14621 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14622 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14623 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14624 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14625 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14626 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14627 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14628 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14629 | spec->vmaster_nid = 0x03; |
| 14630 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14631 | codec->patch_ops = alc_patch_ops; |
| 14632 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14633 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14634 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14635 | if (!spec->loopback.amplist) |
| 14636 | spec->loopback.amplist = alc861_loopbacks; |
| 14637 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14638 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14640 | return 0; |
| 14641 | } |
| 14642 | |
| 14643 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14644 | * ALC861-VD support |
| 14645 | * |
| 14646 | * Based on ALC882 |
| 14647 | * |
| 14648 | * In addition, an independent DAC |
| 14649 | */ |
| 14650 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14651 | |
| 14652 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14653 | /* front, surr, clfe, side surr */ |
| 14654 | 0x02, 0x03, 0x04, 0x05 |
| 14655 | }; |
| 14656 | |
| 14657 | /* dac_nids for ALC660vd are in a different order - according to |
| 14658 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14659 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14660 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14661 | * - and it is the same as in 861vd. |
| 14662 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14663 | */ |
| 14664 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14665 | /* front, rear, clfe, rear_surr */ |
| 14666 | 0x02, 0x04, 0x03 |
| 14667 | }; |
| 14668 | |
| 14669 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14670 | /* ADC0 */ |
| 14671 | 0x09, |
| 14672 | }; |
| 14673 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14674 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14675 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14676 | /* input MUX */ |
| 14677 | /* FIXME: should be a matrix-type input source selection */ |
| 14678 | static struct hda_input_mux alc861vd_capture_source = { |
| 14679 | .num_items = 4, |
| 14680 | .items = { |
| 14681 | { "Mic", 0x0 }, |
| 14682 | { "Front Mic", 0x1 }, |
| 14683 | { "Line", 0x2 }, |
| 14684 | { "CD", 0x4 }, |
| 14685 | }, |
| 14686 | }; |
| 14687 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14688 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14689 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14690 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14691 | { "Ext Mic", 0x0 }, |
| 14692 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14693 | }, |
| 14694 | }; |
| 14695 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14696 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14697 | .num_items = 2, |
| 14698 | .items = { |
| 14699 | { "Front Mic", 0x0 }, |
| 14700 | { "ATAPI Mic", 0x1 }, |
| 14701 | }, |
| 14702 | }; |
| 14703 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14704 | /* |
| 14705 | * 2ch mode |
| 14706 | */ |
| 14707 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14708 | { 2, NULL } |
| 14709 | }; |
| 14710 | |
| 14711 | /* |
| 14712 | * 6ch mode |
| 14713 | */ |
| 14714 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14715 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14716 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14717 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14718 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14719 | { } /* end */ |
| 14720 | }; |
| 14721 | |
| 14722 | /* |
| 14723 | * 8ch mode |
| 14724 | */ |
| 14725 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14726 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14727 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14728 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14729 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14730 | { } /* end */ |
| 14731 | }; |
| 14732 | |
| 14733 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14734 | { 6, alc861vd_6stack_ch6_init }, |
| 14735 | { 8, alc861vd_6stack_ch8_init }, |
| 14736 | }; |
| 14737 | |
| 14738 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14739 | { |
| 14740 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14741 | .name = "Channel Mode", |
| 14742 | .info = alc_ch_mode_info, |
| 14743 | .get = alc_ch_mode_get, |
| 14744 | .put = alc_ch_mode_put, |
| 14745 | }, |
| 14746 | { } /* end */ |
| 14747 | }; |
| 14748 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14749 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14750 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14751 | */ |
| 14752 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14753 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14754 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14755 | |
| 14756 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14757 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14758 | |
| 14759 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14760 | HDA_OUTPUT), |
| 14761 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14762 | HDA_OUTPUT), |
| 14763 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14764 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14765 | |
| 14766 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14767 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14768 | |
| 14769 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14770 | |
| 14771 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14774 | |
| 14775 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14776 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14777 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14778 | |
| 14779 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14780 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14781 | |
| 14782 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14783 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14784 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14785 | { } /* end */ |
| 14786 | }; |
| 14787 | |
| 14788 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14789 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14790 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14791 | |
| 14792 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14793 | |
| 14794 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14795 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14796 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14797 | |
| 14798 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14799 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14801 | |
| 14802 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14803 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14804 | |
| 14805 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14806 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14807 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14808 | { } /* end */ |
| 14809 | }; |
| 14810 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14811 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14812 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14813 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14814 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14815 | |
| 14816 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14817 | |
| 14818 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14821 | |
| 14822 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14823 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14824 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14825 | |
| 14826 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14827 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14828 | |
| 14829 | { } /* end */ |
| 14830 | }; |
| 14831 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14832 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14833 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14834 | */ |
| 14835 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14836 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14837 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14838 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14839 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14840 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14841 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14842 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14843 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14844 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14845 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14846 | { } /* end */ |
| 14847 | }; |
| 14848 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14849 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14850 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14851 | */ |
| 14852 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14853 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14854 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14855 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14856 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14857 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14858 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14859 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14860 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14861 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14862 | { } /* end */ |
| 14863 | }; |
| 14864 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14865 | /* |
| 14866 | * generic initialization of ADC, input mixers and output mixers |
| 14867 | */ |
| 14868 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14869 | /* |
| 14870 | * Unmute ADC0 and set the default input to mic-in |
| 14871 | */ |
| 14872 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14873 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14874 | |
| 14875 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14876 | * the analog-loopback mixer widget |
| 14877 | */ |
| 14878 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14879 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14880 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14881 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14884 | |
| 14885 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14886 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14887 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14888 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14890 | |
| 14891 | /* |
| 14892 | * Set up output mixers (0x02 - 0x05) |
| 14893 | */ |
| 14894 | /* set vol=0 to output mixers */ |
| 14895 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14896 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14897 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14898 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14899 | |
| 14900 | /* set up input amps for analog loopback */ |
| 14901 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14902 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14904 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14905 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14906 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14907 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14908 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14909 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14910 | |
| 14911 | { } |
| 14912 | }; |
| 14913 | |
| 14914 | /* |
| 14915 | * 3-stack pin configuration: |
| 14916 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14917 | */ |
| 14918 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14919 | /* |
| 14920 | * Set pin mode and muting |
| 14921 | */ |
| 14922 | /* set front pin widgets 0x14 for output */ |
| 14923 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14924 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14925 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14926 | |
| 14927 | /* Mic (rear) pin: input vref at 80% */ |
| 14928 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14930 | /* Front Mic pin: input vref at 80% */ |
| 14931 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14932 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14933 | /* Line In pin: input */ |
| 14934 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14935 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14936 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14937 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14938 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14939 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14940 | /* CD pin widget for input */ |
| 14941 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14942 | |
| 14943 | { } |
| 14944 | }; |
| 14945 | |
| 14946 | /* |
| 14947 | * 6-stack pin configuration: |
| 14948 | */ |
| 14949 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14950 | /* |
| 14951 | * Set pin mode and muting |
| 14952 | */ |
| 14953 | /* set front pin widgets 0x14 for output */ |
| 14954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14955 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14956 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14957 | |
| 14958 | /* Rear Pin: output 1 (0x0d) */ |
| 14959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14960 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14961 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14962 | /* CLFE Pin: output 2 (0x0e) */ |
| 14963 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14964 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14965 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14966 | /* Side Pin: output 3 (0x0f) */ |
| 14967 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14968 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14969 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14970 | |
| 14971 | /* Mic (rear) pin: input vref at 80% */ |
| 14972 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14973 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14974 | /* Front Mic pin: input vref at 80% */ |
| 14975 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14976 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14977 | /* Line In pin: input */ |
| 14978 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14979 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14980 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14981 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14982 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14983 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14984 | /* CD pin widget for input */ |
| 14985 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14986 | |
| 14987 | { } |
| 14988 | }; |
| 14989 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14990 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14991 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14992 | { } |
| 14993 | }; |
| 14994 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14995 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14996 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14997 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14998 | { } |
| 14999 | }; |
| 15000 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15001 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15002 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15003 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15005 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15006 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15007 | {} |
| 15008 | }; |
| 15009 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15010 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15011 | { |
| 15012 | unsigned int present; |
| 15013 | unsigned char bits; |
| 15014 | |
| 15015 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15016 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15017 | bits = present ? HDA_AMP_MUTE : 0; |
| 15018 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15019 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15020 | } |
| 15021 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15022 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15023 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15024 | struct alc_spec *spec = codec->spec; |
| 15025 | |
| 15026 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15027 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15028 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15029 | alc861vd_lenovo_mic_automute(codec); |
| 15030 | } |
| 15031 | |
| 15032 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15033 | unsigned int res) |
| 15034 | { |
| 15035 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15036 | case ALC880_MIC_EVENT: |
| 15037 | alc861vd_lenovo_mic_automute(codec); |
| 15038 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15039 | default: |
| 15040 | alc_automute_amp_unsol_event(codec, res); |
| 15041 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15042 | } |
| 15043 | } |
| 15044 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15045 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15046 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15047 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15048 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15049 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15050 | |
| 15051 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15052 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15053 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15054 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15056 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15057 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15058 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15059 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15060 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15061 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15063 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15064 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15065 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15066 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15067 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15068 | |
| 15069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15070 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15071 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15072 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15073 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15074 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15075 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15076 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15077 | |
| 15078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15082 | |
| 15083 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15084 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15085 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15086 | |
| 15087 | { } /* end */ |
| 15088 | }; |
| 15089 | |
| 15090 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15091 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15092 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15093 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15094 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15095 | spec->autocfg.hp_pins[0] = 0x15; |
| 15096 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15097 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15098 | } |
| 15099 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15100 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15101 | #define alc861vd_loopbacks alc880_loopbacks |
| 15102 | #endif |
| 15103 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15104 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15105 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15106 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15107 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15108 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15109 | |
| 15110 | /* |
| 15111 | * configuration and preset |
| 15112 | */ |
| 15113 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15114 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15115 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15116 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15117 | [ALC861VD_3ST] = "3stack", |
| 15118 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15119 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15120 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15121 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15122 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15123 | [ALC861VD_AUTO] = "auto", |
| 15124 | }; |
| 15125 | |
| 15126 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15127 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15128 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15129 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15130 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15131 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15132 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15133 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15134 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15135 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15136 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15137 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15138 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15139 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15140 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15141 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15142 | {} |
| 15143 | }; |
| 15144 | |
| 15145 | static struct alc_config_preset alc861vd_presets[] = { |
| 15146 | [ALC660VD_3ST] = { |
| 15147 | .mixers = { alc861vd_3st_mixer }, |
| 15148 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15149 | alc861vd_3stack_init_verbs }, |
| 15150 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15151 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15152 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15153 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15154 | .input_mux = &alc861vd_capture_source, |
| 15155 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15156 | [ALC660VD_3ST_DIG] = { |
| 15157 | .mixers = { alc861vd_3st_mixer }, |
| 15158 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15159 | alc861vd_3stack_init_verbs }, |
| 15160 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15161 | .dac_nids = alc660vd_dac_nids, |
| 15162 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15163 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15164 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15165 | .input_mux = &alc861vd_capture_source, |
| 15166 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15167 | [ALC861VD_3ST] = { |
| 15168 | .mixers = { alc861vd_3st_mixer }, |
| 15169 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15170 | alc861vd_3stack_init_verbs }, |
| 15171 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15172 | .dac_nids = alc861vd_dac_nids, |
| 15173 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15174 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15175 | .input_mux = &alc861vd_capture_source, |
| 15176 | }, |
| 15177 | [ALC861VD_3ST_DIG] = { |
| 15178 | .mixers = { alc861vd_3st_mixer }, |
| 15179 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15180 | alc861vd_3stack_init_verbs }, |
| 15181 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15182 | .dac_nids = alc861vd_dac_nids, |
| 15183 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15184 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15185 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15186 | .input_mux = &alc861vd_capture_source, |
| 15187 | }, |
| 15188 | [ALC861VD_6ST_DIG] = { |
| 15189 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15190 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15191 | alc861vd_6stack_init_verbs }, |
| 15192 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15193 | .dac_nids = alc861vd_dac_nids, |
| 15194 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15195 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15196 | .channel_mode = alc861vd_6stack_modes, |
| 15197 | .input_mux = &alc861vd_capture_source, |
| 15198 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15199 | [ALC861VD_LENOVO] = { |
| 15200 | .mixers = { alc861vd_lenovo_mixer }, |
| 15201 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15202 | alc861vd_3stack_init_verbs, |
| 15203 | alc861vd_eapd_verbs, |
| 15204 | alc861vd_lenovo_unsol_verbs }, |
| 15205 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15206 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15207 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15208 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15209 | .input_mux = &alc861vd_capture_source, |
| 15210 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15211 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15212 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15213 | [ALC861VD_DALLAS] = { |
| 15214 | .mixers = { alc861vd_dallas_mixer }, |
| 15215 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15216 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15217 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15218 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15219 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15220 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15221 | .unsol_event = alc_automute_amp_unsol_event, |
| 15222 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15223 | }, |
| 15224 | [ALC861VD_HP] = { |
| 15225 | .mixers = { alc861vd_hp_mixer }, |
| 15226 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15227 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15228 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15229 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15230 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15231 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15232 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15233 | .unsol_event = alc_automute_amp_unsol_event, |
| 15234 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15235 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15236 | [ALC660VD_ASUS_V1S] = { |
| 15237 | .mixers = { alc861vd_lenovo_mixer }, |
| 15238 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15239 | alc861vd_3stack_init_verbs, |
| 15240 | alc861vd_eapd_verbs, |
| 15241 | alc861vd_lenovo_unsol_verbs }, |
| 15242 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15243 | .dac_nids = alc660vd_dac_nids, |
| 15244 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15245 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15246 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15247 | .input_mux = &alc861vd_capture_source, |
| 15248 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15249 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15250 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15251 | }; |
| 15252 | |
| 15253 | /* |
| 15254 | * BIOS auto configuration |
| 15255 | */ |
| 15256 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15257 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15258 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15259 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15260 | } |
| 15261 | |
| 15262 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15263 | { |
| 15264 | struct alc_spec *spec = codec->spec; |
| 15265 | int i; |
| 15266 | |
| 15267 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15268 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15269 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15270 | if (nid) |
| 15271 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15272 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15273 | } |
| 15274 | } |
| 15275 | |
| 15276 | |
| 15277 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15278 | { |
| 15279 | struct alc_spec *spec = codec->spec; |
| 15280 | hda_nid_t pin; |
| 15281 | |
| 15282 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15283 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15284 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15285 | pin = spec->autocfg.speaker_pins[0]; |
| 15286 | if (pin) |
| 15287 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15288 | } |
| 15289 | |
| 15290 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15291 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15292 | |
| 15293 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15294 | { |
| 15295 | struct alc_spec *spec = codec->spec; |
| 15296 | int i; |
| 15297 | |
| 15298 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15299 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15300 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15301 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15302 | if (nid != ALC861VD_PIN_CD_NID && |
| 15303 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15304 | snd_hda_codec_write(codec, nid, 0, |
| 15305 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15306 | AMP_OUT_MUTE); |
| 15307 | } |
| 15308 | } |
| 15309 | } |
| 15310 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15311 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15312 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15313 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15314 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15315 | |
| 15316 | /* add playback controls from the parsed DAC table */ |
| 15317 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15318 | * different NIDs for mute/unmute switch and volume control */ |
| 15319 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15320 | const struct auto_pin_cfg *cfg) |
| 15321 | { |
| 15322 | char name[32]; |
| 15323 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15324 | hda_nid_t nid_v, nid_s; |
| 15325 | int i, err; |
| 15326 | |
| 15327 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15328 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15329 | continue; |
| 15330 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15331 | alc880_dac_to_idx( |
| 15332 | spec->multiout.dac_nids[i])); |
| 15333 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15334 | alc880_dac_to_idx( |
| 15335 | spec->multiout.dac_nids[i])); |
| 15336 | |
| 15337 | if (i == 2) { |
| 15338 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15339 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15340 | "Center Playback Volume", |
| 15341 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15342 | HDA_OUTPUT)); |
| 15343 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15344 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15345 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15346 | "LFE Playback Volume", |
| 15347 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15348 | HDA_OUTPUT)); |
| 15349 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15350 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15351 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15352 | "Center Playback Switch", |
| 15353 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15354 | HDA_INPUT)); |
| 15355 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15356 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15357 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15358 | "LFE Playback Switch", |
| 15359 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15360 | HDA_INPUT)); |
| 15361 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15362 | return err; |
| 15363 | } else { |
| 15364 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15365 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15366 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15367 | HDA_OUTPUT)); |
| 15368 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15369 | return err; |
| 15370 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15371 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15372 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15373 | HDA_INPUT)); |
| 15374 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15375 | return err; |
| 15376 | } |
| 15377 | } |
| 15378 | return 0; |
| 15379 | } |
| 15380 | |
| 15381 | /* add playback controls for speaker and HP outputs */ |
| 15382 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15383 | * different NIDs for mute/unmute switch and volume control */ |
| 15384 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15385 | hda_nid_t pin, const char *pfx) |
| 15386 | { |
| 15387 | hda_nid_t nid_v, nid_s; |
| 15388 | int err; |
| 15389 | char name[32]; |
| 15390 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15391 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15392 | return 0; |
| 15393 | |
| 15394 | if (alc880_is_fixed_pin(pin)) { |
| 15395 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15396 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15397 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15398 | spec->multiout.hp_nid = nid_v; |
| 15399 | else |
| 15400 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15401 | /* control HP volume/switch on the output mixer amp */ |
| 15402 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15403 | alc880_fixed_pin_idx(pin)); |
| 15404 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15405 | alc880_fixed_pin_idx(pin)); |
| 15406 | |
| 15407 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15408 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15409 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15410 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15411 | return err; |
| 15412 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15413 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15414 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15415 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15416 | return err; |
| 15417 | } else if (alc880_is_multi_pin(pin)) { |
| 15418 | /* set manual connection */ |
| 15419 | /* we have only a switch on HP-out PIN */ |
| 15420 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15421 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15422 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15423 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15424 | return err; |
| 15425 | } |
| 15426 | return 0; |
| 15427 | } |
| 15428 | |
| 15429 | /* parse the BIOS configuration and set up the alc_spec |
| 15430 | * return 1 if successful, 0 if the proper config is not found, |
| 15431 | * or a negative error code |
| 15432 | * Based on ALC880 version - had to change it to override |
| 15433 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15434 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15435 | { |
| 15436 | struct alc_spec *spec = codec->spec; |
| 15437 | int err; |
| 15438 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15439 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15440 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15441 | alc861vd_ignore); |
| 15442 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15443 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15444 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15445 | return 0; /* can't find valid BIOS pin config */ |
| 15446 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15447 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15448 | if (err < 0) |
| 15449 | return err; |
| 15450 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15451 | if (err < 0) |
| 15452 | return err; |
| 15453 | err = alc861vd_auto_create_extra_out(spec, |
| 15454 | spec->autocfg.speaker_pins[0], |
| 15455 | "Speaker"); |
| 15456 | if (err < 0) |
| 15457 | return err; |
| 15458 | err = alc861vd_auto_create_extra_out(spec, |
| 15459 | spec->autocfg.hp_pins[0], |
| 15460 | "Headphone"); |
| 15461 | if (err < 0) |
| 15462 | return err; |
| 15463 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15464 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15465 | return err; |
| 15466 | |
| 15467 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15468 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15469 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15470 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15471 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15472 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15473 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15474 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15475 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15476 | |
| 15477 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15478 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15479 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15480 | err = alc_auto_add_mic_boost(codec); |
| 15481 | if (err < 0) |
| 15482 | return err; |
| 15483 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15484 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15485 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15486 | return 1; |
| 15487 | } |
| 15488 | |
| 15489 | /* additional initialization for auto-configuration model */ |
| 15490 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15491 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15492 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15493 | alc861vd_auto_init_multi_out(codec); |
| 15494 | alc861vd_auto_init_hp_out(codec); |
| 15495 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15496 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15497 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15498 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15499 | } |
| 15500 | |
| 15501 | static int patch_alc861vd(struct hda_codec *codec) |
| 15502 | { |
| 15503 | struct alc_spec *spec; |
| 15504 | int err, board_config; |
| 15505 | |
| 15506 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15507 | if (spec == NULL) |
| 15508 | return -ENOMEM; |
| 15509 | |
| 15510 | codec->spec = spec; |
| 15511 | |
| 15512 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15513 | alc861vd_models, |
| 15514 | alc861vd_cfg_tbl); |
| 15515 | |
| 15516 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 15517 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 15518 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15519 | board_config = ALC861VD_AUTO; |
| 15520 | } |
| 15521 | |
| 15522 | if (board_config == ALC861VD_AUTO) { |
| 15523 | /* automatic parse from the BIOS config */ |
| 15524 | err = alc861vd_parse_auto_config(codec); |
| 15525 | if (err < 0) { |
| 15526 | alc_free(codec); |
| 15527 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15528 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15529 | printk(KERN_INFO |
| 15530 | "hda_codec: Cannot set up configuration " |
| 15531 | "from BIOS. Using base mode...\n"); |
| 15532 | board_config = ALC861VD_3ST; |
| 15533 | } |
| 15534 | } |
| 15535 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15536 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15537 | if (err < 0) { |
| 15538 | alc_free(codec); |
| 15539 | return err; |
| 15540 | } |
| 15541 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15542 | if (board_config != ALC861VD_AUTO) |
| 15543 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15544 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15545 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15546 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15547 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15548 | } |
| 15549 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15550 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15551 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15552 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15553 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15554 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15555 | |
| 15556 | spec->adc_nids = alc861vd_adc_nids; |
| 15557 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15558 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15559 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15560 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15561 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15562 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15563 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15564 | spec->vmaster_nid = 0x02; |
| 15565 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15566 | codec->patch_ops = alc_patch_ops; |
| 15567 | |
| 15568 | if (board_config == ALC861VD_AUTO) |
| 15569 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15570 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15571 | if (!spec->loopback.amplist) |
| 15572 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15573 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15574 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15575 | |
| 15576 | return 0; |
| 15577 | } |
| 15578 | |
| 15579 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15580 | * ALC662 support |
| 15581 | * |
| 15582 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15583 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15584 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15585 | * 6-channel independent captures. |
| 15586 | * |
| 15587 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15588 | * driver yet). |
| 15589 | */ |
| 15590 | #define ALC662_DIGOUT_NID 0x06 |
| 15591 | #define ALC662_DIGIN_NID 0x0a |
| 15592 | |
| 15593 | static hda_nid_t alc662_dac_nids[4] = { |
| 15594 | /* front, rear, clfe, rear_surr */ |
| 15595 | 0x02, 0x03, 0x04 |
| 15596 | }; |
| 15597 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15598 | static hda_nid_t alc272_dac_nids[2] = { |
| 15599 | 0x02, 0x03 |
| 15600 | }; |
| 15601 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15602 | static hda_nid_t alc662_adc_nids[1] = { |
| 15603 | /* ADC1-2 */ |
| 15604 | 0x09, |
| 15605 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15606 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15607 | static hda_nid_t alc272_adc_nids[1] = { |
| 15608 | /* ADC1-2 */ |
| 15609 | 0x08, |
| 15610 | }; |
| 15611 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15612 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15613 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15614 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15615 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15616 | /* input MUX */ |
| 15617 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15618 | static struct hda_input_mux alc662_capture_source = { |
| 15619 | .num_items = 4, |
| 15620 | .items = { |
| 15621 | { "Mic", 0x0 }, |
| 15622 | { "Front Mic", 0x1 }, |
| 15623 | { "Line", 0x2 }, |
| 15624 | { "CD", 0x4 }, |
| 15625 | }, |
| 15626 | }; |
| 15627 | |
| 15628 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15629 | .num_items = 2, |
| 15630 | .items = { |
| 15631 | { "Mic", 0x1 }, |
| 15632 | { "Line", 0x2 }, |
| 15633 | }, |
| 15634 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15635 | |
| 15636 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15637 | .num_items = 2, |
| 15638 | .items = { |
| 15639 | { "i-Mic", 0x1 }, |
| 15640 | { "e-Mic", 0x0 }, |
| 15641 | }, |
| 15642 | }; |
| 15643 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15644 | static struct hda_input_mux alc663_capture_source = { |
| 15645 | .num_items = 3, |
| 15646 | .items = { |
| 15647 | { "Mic", 0x0 }, |
| 15648 | { "Front Mic", 0x1 }, |
| 15649 | { "Line", 0x2 }, |
| 15650 | }, |
| 15651 | }; |
| 15652 | |
| 15653 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15654 | .num_items = 2, |
| 15655 | .items = { |
| 15656 | { "Ext-Mic", 0x0 }, |
| 15657 | { "D-Mic", 0x9 }, |
| 15658 | }, |
| 15659 | }; |
| 15660 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15661 | #if 1 /* set to 0 for testing other input sources below */ |
| 15662 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15663 | .num_items = 2, |
| 15664 | .items = { |
| 15665 | { "Autoselect Mic", 0x0 }, |
| 15666 | { "Internal Mic", 0x1 }, |
| 15667 | }, |
| 15668 | }; |
| 15669 | #else |
| 15670 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15671 | .num_items = 16, |
| 15672 | .items = { |
| 15673 | { "Autoselect Mic", 0x0 }, |
| 15674 | { "Internal Mic", 0x1 }, |
| 15675 | { "In-0x02", 0x2 }, |
| 15676 | { "In-0x03", 0x3 }, |
| 15677 | { "In-0x04", 0x4 }, |
| 15678 | { "In-0x05", 0x5 }, |
| 15679 | { "In-0x06", 0x6 }, |
| 15680 | { "In-0x07", 0x7 }, |
| 15681 | { "In-0x08", 0x8 }, |
| 15682 | { "In-0x09", 0x9 }, |
| 15683 | { "In-0x0a", 0x0a }, |
| 15684 | { "In-0x0b", 0x0b }, |
| 15685 | { "In-0x0c", 0x0c }, |
| 15686 | { "In-0x0d", 0x0d }, |
| 15687 | { "In-0x0e", 0x0e }, |
| 15688 | { "In-0x0f", 0x0f }, |
| 15689 | }, |
| 15690 | }; |
| 15691 | #endif |
| 15692 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15693 | /* |
| 15694 | * 2ch mode |
| 15695 | */ |
| 15696 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15697 | { 2, NULL } |
| 15698 | }; |
| 15699 | |
| 15700 | /* |
| 15701 | * 2ch mode |
| 15702 | */ |
| 15703 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15704 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15705 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15706 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15707 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15708 | { } /* end */ |
| 15709 | }; |
| 15710 | |
| 15711 | /* |
| 15712 | * 6ch mode |
| 15713 | */ |
| 15714 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15715 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15716 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15717 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15718 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15719 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15720 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15721 | { } /* end */ |
| 15722 | }; |
| 15723 | |
| 15724 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15725 | { 2, alc662_3ST_ch2_init }, |
| 15726 | { 6, alc662_3ST_ch6_init }, |
| 15727 | }; |
| 15728 | |
| 15729 | /* |
| 15730 | * 2ch mode |
| 15731 | */ |
| 15732 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15733 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15734 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15735 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15736 | { } /* end */ |
| 15737 | }; |
| 15738 | |
| 15739 | /* |
| 15740 | * 6ch mode |
| 15741 | */ |
| 15742 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15743 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15744 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15745 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15746 | { } /* end */ |
| 15747 | }; |
| 15748 | |
| 15749 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15750 | { 2, alc662_sixstack_ch6_init }, |
| 15751 | { 6, alc662_sixstack_ch8_init }, |
| 15752 | }; |
| 15753 | |
| 15754 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15755 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15756 | */ |
| 15757 | |
| 15758 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15759 | /* output mixer control */ |
| 15760 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15761 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15762 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15763 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15764 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15765 | 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] | 15766 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15767 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15769 | |
| 15770 | /*Input mixer control */ |
| 15771 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15772 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15773 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15774 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15775 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15776 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15777 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15778 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15779 | { } /* end */ |
| 15780 | }; |
| 15781 | |
| 15782 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15783 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15784 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15785 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15786 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15787 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15788 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15789 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15790 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15791 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15792 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15793 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15794 | { } /* end */ |
| 15795 | }; |
| 15796 | |
| 15797 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15798 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15799 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15800 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15801 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15802 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15803 | 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] | 15804 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15805 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15806 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15807 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15808 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15809 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15810 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15813 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15814 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15815 | { } /* end */ |
| 15816 | }; |
| 15817 | |
| 15818 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15819 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15820 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15821 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15822 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15823 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15824 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15825 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15826 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15828 | { } /* end */ |
| 15829 | }; |
| 15830 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15831 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15832 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15833 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15834 | |
| 15835 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15836 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15837 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15838 | |
| 15839 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15840 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15841 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15842 | { } /* end */ |
| 15843 | }; |
| 15844 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15845 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15846 | ALC262_HIPPO_MASTER_SWITCH, |
| 15847 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15848 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15849 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15850 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15851 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15852 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15853 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15854 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15855 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15856 | { } /* end */ |
| 15857 | }; |
| 15858 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15859 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15860 | .ops = &snd_hda_bind_vol, |
| 15861 | .values = { |
| 15862 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15863 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15864 | 0 |
| 15865 | }, |
| 15866 | }; |
| 15867 | |
| 15868 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15869 | .ops = &snd_hda_bind_sw, |
| 15870 | .values = { |
| 15871 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15872 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15873 | 0 |
| 15874 | }, |
| 15875 | }; |
| 15876 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15877 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15878 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15879 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15880 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15882 | { } /* end */ |
| 15883 | }; |
| 15884 | |
| 15885 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15886 | .ops = &snd_hda_bind_sw, |
| 15887 | .values = { |
| 15888 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15889 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15890 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15891 | 0 |
| 15892 | }, |
| 15893 | }; |
| 15894 | |
| 15895 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15896 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15897 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15900 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15901 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15902 | |
| 15903 | { } /* end */ |
| 15904 | }; |
| 15905 | |
| 15906 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15907 | .ops = &snd_hda_bind_sw, |
| 15908 | .values = { |
| 15909 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15910 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15911 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15912 | 0 |
| 15913 | }, |
| 15914 | }; |
| 15915 | |
| 15916 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15917 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15918 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15919 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15920 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15921 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15922 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15923 | { } /* end */ |
| 15924 | }; |
| 15925 | |
| 15926 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15927 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15928 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15929 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15930 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15931 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15932 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15933 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15934 | { } /* end */ |
| 15935 | }; |
| 15936 | |
| 15937 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15938 | .ops = &snd_hda_bind_vol, |
| 15939 | .values = { |
| 15940 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15941 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15942 | 0 |
| 15943 | }, |
| 15944 | }; |
| 15945 | |
| 15946 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15947 | .ops = &snd_hda_bind_sw, |
| 15948 | .values = { |
| 15949 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15950 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15951 | 0 |
| 15952 | }, |
| 15953 | }; |
| 15954 | |
| 15955 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15956 | HDA_BIND_VOL("Master Playback Volume", |
| 15957 | &alc663_asus_two_bind_master_vol), |
| 15958 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15959 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15960 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15963 | { } /* end */ |
| 15964 | }; |
| 15965 | |
| 15966 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15967 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15968 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15969 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15970 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15971 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15972 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15973 | { } /* end */ |
| 15974 | }; |
| 15975 | |
| 15976 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15977 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15978 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15980 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15981 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15982 | |
| 15983 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15984 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15985 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15986 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15987 | { } /* end */ |
| 15988 | }; |
| 15989 | |
| 15990 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15991 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15992 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15993 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15994 | |
| 15995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15997 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15998 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15999 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16000 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16001 | { } /* end */ |
| 16002 | }; |
| 16003 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16004 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16005 | { |
| 16006 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16007 | .name = "Channel Mode", |
| 16008 | .info = alc_ch_mode_info, |
| 16009 | .get = alc_ch_mode_get, |
| 16010 | .put = alc_ch_mode_put, |
| 16011 | }, |
| 16012 | { } /* end */ |
| 16013 | }; |
| 16014 | |
| 16015 | static struct hda_verb alc662_init_verbs[] = { |
| 16016 | /* ADC: mute amp left and right */ |
| 16017 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16018 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16019 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16020 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16021 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16022 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16025 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16026 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16027 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16028 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16029 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16030 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16031 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16032 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16033 | |
| 16034 | /* Front Pin: output 0 (0x0c) */ |
| 16035 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16036 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16037 | |
| 16038 | /* Rear Pin: output 1 (0x0d) */ |
| 16039 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16040 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16041 | |
| 16042 | /* CLFE Pin: output 2 (0x0e) */ |
| 16043 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16044 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16045 | |
| 16046 | /* Mic (rear) pin: input vref at 80% */ |
| 16047 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16048 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16049 | /* Front Mic pin: input vref at 80% */ |
| 16050 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16051 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16052 | /* Line In pin: input */ |
| 16053 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16054 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16055 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16056 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16057 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16058 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16059 | /* CD pin widget for input */ |
| 16060 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16061 | |
| 16062 | /* FIXME: use matrix-type input source selection */ |
| 16063 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16064 | /* Input mixer */ |
| 16065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16066 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16067 | |
| 16068 | /* always trun on EAPD */ |
| 16069 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16070 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16071 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16072 | { } |
| 16073 | }; |
| 16074 | |
| 16075 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16076 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16077 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16078 | {} |
| 16079 | }; |
| 16080 | |
| 16081 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16082 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16083 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16084 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16085 | }; |
| 16086 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16087 | /* Set Unsolicited Event*/ |
| 16088 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16089 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16090 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16091 | {} |
| 16092 | }; |
| 16093 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16094 | /* |
| 16095 | * generic initialization of ADC, input mixers and output mixers |
| 16096 | */ |
| 16097 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16098 | /* |
| 16099 | * Unmute ADC and set the default input to mic-in |
| 16100 | */ |
| 16101 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16103 | |
| 16104 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16105 | * mixer widget |
| 16106 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16107 | * panel mic (mic 2) |
| 16108 | */ |
| 16109 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16115 | |
| 16116 | /* |
| 16117 | * Set up output mixers (0x0c - 0x0f) |
| 16118 | */ |
| 16119 | /* set vol=0 to output mixers */ |
| 16120 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16121 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16122 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16123 | |
| 16124 | /* set up input amps for analog loopback */ |
| 16125 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16126 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16127 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16128 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16129 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16130 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16132 | |
| 16133 | |
| 16134 | /* FIXME: use matrix-type input source selection */ |
| 16135 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16136 | /* Input mixer */ |
| 16137 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16138 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16139 | { } |
| 16140 | }; |
| 16141 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16142 | /* additional verbs for ALC663 */ |
| 16143 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16144 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16145 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16146 | { } |
| 16147 | }; |
| 16148 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16149 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16150 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16151 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16152 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16153 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16154 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16157 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16158 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16159 | {} |
| 16160 | }; |
| 16161 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16162 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16163 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16164 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16165 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16166 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16167 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16168 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16169 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16170 | {} |
| 16171 | }; |
| 16172 | |
| 16173 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16174 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16175 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16176 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16177 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16180 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16181 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16182 | {} |
| 16183 | }; |
| 16184 | |
| 16185 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16186 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16188 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16191 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16192 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16193 | {} |
| 16194 | }; |
| 16195 | |
| 16196 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16197 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16198 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16199 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16200 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16201 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16202 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16203 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16205 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16206 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16207 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16208 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16209 | {} |
| 16210 | }; |
| 16211 | |
| 16212 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16213 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16214 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16215 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16216 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16217 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16218 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16219 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16220 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16221 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16222 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16223 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16224 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16225 | {} |
| 16226 | }; |
| 16227 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16228 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16229 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16230 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16231 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16232 | |
| 16233 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16234 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16235 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16236 | |
| 16237 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16238 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16239 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16240 | {} |
| 16241 | }; |
| 16242 | |
| 16243 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16244 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16245 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16246 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16247 | |
| 16248 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16249 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16250 | {} |
| 16251 | }; |
| 16252 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16253 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16254 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16255 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16256 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16257 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16258 | {} |
| 16259 | }; |
| 16260 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16261 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16262 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16263 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16264 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16265 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16266 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16267 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16268 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16269 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16270 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16271 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16272 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16273 | {} |
| 16274 | }; |
| 16275 | |
| 16276 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16277 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16278 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16279 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16280 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16281 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16282 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16283 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16284 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16285 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16286 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16287 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16288 | {} |
| 16289 | }; |
| 16290 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16291 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16292 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16293 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16294 | { } /* end */ |
| 16295 | }; |
| 16296 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16297 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16298 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16299 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16300 | { } /* end */ |
| 16301 | }; |
| 16302 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16303 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16304 | { |
| 16305 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16306 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16307 | |
| 16308 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16309 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16310 | bits = present ? HDA_AMP_MUTE : 0; |
| 16311 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16312 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16313 | } |
| 16314 | |
| 16315 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16316 | { |
| 16317 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16318 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16319 | |
| 16320 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16321 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16322 | bits = present ? HDA_AMP_MUTE : 0; |
| 16323 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16324 | HDA_AMP_MUTE, bits); |
| 16325 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16326 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16327 | } |
| 16328 | |
| 16329 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16330 | unsigned int res) |
| 16331 | { |
| 16332 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16333 | alc662_lenovo_101e_all_automute(codec); |
| 16334 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16335 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16336 | } |
| 16337 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16338 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 16339 | { |
| 16340 | unsigned int present; |
| 16341 | |
| 16342 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 16343 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16344 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16345 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16346 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16347 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16348 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16349 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16350 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16351 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16352 | } |
| 16353 | |
| 16354 | /* unsolicited event for HP jack sensing */ |
| 16355 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16356 | unsigned int res) |
| 16357 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16358 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16359 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16360 | else |
| 16361 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16362 | } |
| 16363 | |
| 16364 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16365 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16366 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16367 | alc662_eeepc_mic_automute(codec); |
| 16368 | } |
| 16369 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16370 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16371 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16372 | struct alc_spec *spec = codec->spec; |
| 16373 | |
| 16374 | spec->autocfg.hp_pins[0] = 0x14; |
| 16375 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 16376 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16377 | } |
| 16378 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16379 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16380 | { |
| 16381 | unsigned int present; |
| 16382 | unsigned char bits; |
| 16383 | |
| 16384 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16385 | AC_VERB_GET_PIN_SENSE, 0) |
| 16386 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16387 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16388 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16389 | AMP_IN_MUTE(0), bits); |
| 16390 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16391 | AMP_IN_MUTE(0), bits); |
| 16392 | } |
| 16393 | |
| 16394 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16395 | { |
| 16396 | unsigned int present; |
| 16397 | unsigned char bits; |
| 16398 | |
| 16399 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16400 | AC_VERB_GET_PIN_SENSE, 0) |
| 16401 | & AC_PINSENSE_PRESENCE; |
| 16402 | bits = present ? HDA_AMP_MUTE : 0; |
| 16403 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16404 | AMP_IN_MUTE(0), bits); |
| 16405 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16406 | AMP_IN_MUTE(0), bits); |
| 16407 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16408 | AMP_IN_MUTE(0), bits); |
| 16409 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16410 | AMP_IN_MUTE(0), bits); |
| 16411 | } |
| 16412 | |
| 16413 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16414 | { |
| 16415 | unsigned int present; |
| 16416 | unsigned char bits; |
| 16417 | |
| 16418 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16419 | AC_VERB_GET_PIN_SENSE, 0) |
| 16420 | & AC_PINSENSE_PRESENCE; |
| 16421 | bits = present ? HDA_AMP_MUTE : 0; |
| 16422 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16423 | AMP_IN_MUTE(0), bits); |
| 16424 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16425 | AMP_IN_MUTE(0), bits); |
| 16426 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16427 | AMP_IN_MUTE(0), bits); |
| 16428 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16429 | AMP_IN_MUTE(0), bits); |
| 16430 | } |
| 16431 | |
| 16432 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16433 | { |
| 16434 | unsigned int present; |
| 16435 | unsigned char bits; |
| 16436 | |
| 16437 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16438 | AC_VERB_GET_PIN_SENSE, 0) |
| 16439 | & AC_PINSENSE_PRESENCE; |
| 16440 | bits = present ? 0 : PIN_OUT; |
| 16441 | snd_hda_codec_write(codec, 0x14, 0, |
| 16442 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16443 | } |
| 16444 | |
| 16445 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16446 | { |
| 16447 | unsigned int present1, present2; |
| 16448 | |
| 16449 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16450 | AC_VERB_GET_PIN_SENSE, 0) |
| 16451 | & AC_PINSENSE_PRESENCE; |
| 16452 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16453 | AC_VERB_GET_PIN_SENSE, 0) |
| 16454 | & AC_PINSENSE_PRESENCE; |
| 16455 | |
| 16456 | if (present1 || present2) { |
| 16457 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16458 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16459 | } else { |
| 16460 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16461 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16462 | } |
| 16463 | } |
| 16464 | |
| 16465 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16466 | { |
| 16467 | unsigned int present1, present2; |
| 16468 | |
| 16469 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16470 | AC_VERB_GET_PIN_SENSE, 0) |
| 16471 | & AC_PINSENSE_PRESENCE; |
| 16472 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16473 | AC_VERB_GET_PIN_SENSE, 0) |
| 16474 | & AC_PINSENSE_PRESENCE; |
| 16475 | |
| 16476 | if (present1 || present2) { |
| 16477 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16478 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16479 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16480 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16481 | } else { |
| 16482 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16483 | AMP_IN_MUTE(0), 0); |
| 16484 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16485 | AMP_IN_MUTE(0), 0); |
| 16486 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16487 | } |
| 16488 | |
| 16489 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16490 | { |
| 16491 | unsigned int present; |
| 16492 | |
| 16493 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16494 | AC_VERB_GET_PIN_SENSE, 0) |
| 16495 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16496 | 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] | 16497 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16498 | 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] | 16499 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16500 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16501 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16502 | 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] | 16503 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16504 | } |
| 16505 | |
| 16506 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16507 | unsigned int res) |
| 16508 | { |
| 16509 | switch (res >> 26) { |
| 16510 | case ALC880_HP_EVENT: |
| 16511 | alc663_m51va_speaker_automute(codec); |
| 16512 | break; |
| 16513 | case ALC880_MIC_EVENT: |
| 16514 | alc663_m51va_mic_automute(codec); |
| 16515 | break; |
| 16516 | } |
| 16517 | } |
| 16518 | |
| 16519 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16520 | { |
| 16521 | alc663_m51va_speaker_automute(codec); |
| 16522 | alc663_m51va_mic_automute(codec); |
| 16523 | } |
| 16524 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16525 | /* ***************** Mode1 ******************************/ |
| 16526 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16527 | unsigned int res) |
| 16528 | { |
| 16529 | switch (res >> 26) { |
| 16530 | case ALC880_HP_EVENT: |
| 16531 | alc663_m51va_speaker_automute(codec); |
| 16532 | break; |
| 16533 | case ALC880_MIC_EVENT: |
| 16534 | alc662_eeepc_mic_automute(codec); |
| 16535 | break; |
| 16536 | } |
| 16537 | } |
| 16538 | |
| 16539 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16540 | { |
| 16541 | alc663_m51va_speaker_automute(codec); |
| 16542 | alc662_eeepc_mic_automute(codec); |
| 16543 | } |
| 16544 | /* ***************** Mode2 ******************************/ |
| 16545 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16546 | unsigned int res) |
| 16547 | { |
| 16548 | switch (res >> 26) { |
| 16549 | case ALC880_HP_EVENT: |
| 16550 | alc662_f5z_speaker_automute(codec); |
| 16551 | break; |
| 16552 | case ALC880_MIC_EVENT: |
| 16553 | alc662_eeepc_mic_automute(codec); |
| 16554 | break; |
| 16555 | } |
| 16556 | } |
| 16557 | |
| 16558 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16559 | { |
| 16560 | alc662_f5z_speaker_automute(codec); |
| 16561 | alc662_eeepc_mic_automute(codec); |
| 16562 | } |
| 16563 | /* ***************** Mode3 ******************************/ |
| 16564 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16565 | unsigned int res) |
| 16566 | { |
| 16567 | switch (res >> 26) { |
| 16568 | case ALC880_HP_EVENT: |
| 16569 | alc663_two_hp_m1_speaker_automute(codec); |
| 16570 | break; |
| 16571 | case ALC880_MIC_EVENT: |
| 16572 | alc662_eeepc_mic_automute(codec); |
| 16573 | break; |
| 16574 | } |
| 16575 | } |
| 16576 | |
| 16577 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16578 | { |
| 16579 | alc663_two_hp_m1_speaker_automute(codec); |
| 16580 | alc662_eeepc_mic_automute(codec); |
| 16581 | } |
| 16582 | /* ***************** Mode4 ******************************/ |
| 16583 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16584 | unsigned int res) |
| 16585 | { |
| 16586 | switch (res >> 26) { |
| 16587 | case ALC880_HP_EVENT: |
| 16588 | alc663_21jd_two_speaker_automute(codec); |
| 16589 | break; |
| 16590 | case ALC880_MIC_EVENT: |
| 16591 | alc662_eeepc_mic_automute(codec); |
| 16592 | break; |
| 16593 | } |
| 16594 | } |
| 16595 | |
| 16596 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16597 | { |
| 16598 | alc663_21jd_two_speaker_automute(codec); |
| 16599 | alc662_eeepc_mic_automute(codec); |
| 16600 | } |
| 16601 | /* ***************** Mode5 ******************************/ |
| 16602 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16603 | unsigned int res) |
| 16604 | { |
| 16605 | switch (res >> 26) { |
| 16606 | case ALC880_HP_EVENT: |
| 16607 | alc663_15jd_two_speaker_automute(codec); |
| 16608 | break; |
| 16609 | case ALC880_MIC_EVENT: |
| 16610 | alc662_eeepc_mic_automute(codec); |
| 16611 | break; |
| 16612 | } |
| 16613 | } |
| 16614 | |
| 16615 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16616 | { |
| 16617 | alc663_15jd_two_speaker_automute(codec); |
| 16618 | alc662_eeepc_mic_automute(codec); |
| 16619 | } |
| 16620 | /* ***************** Mode6 ******************************/ |
| 16621 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16622 | unsigned int res) |
| 16623 | { |
| 16624 | switch (res >> 26) { |
| 16625 | case ALC880_HP_EVENT: |
| 16626 | alc663_two_hp_m2_speaker_automute(codec); |
| 16627 | break; |
| 16628 | case ALC880_MIC_EVENT: |
| 16629 | alc662_eeepc_mic_automute(codec); |
| 16630 | break; |
| 16631 | } |
| 16632 | } |
| 16633 | |
| 16634 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16635 | { |
| 16636 | alc663_two_hp_m2_speaker_automute(codec); |
| 16637 | alc662_eeepc_mic_automute(codec); |
| 16638 | } |
| 16639 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16640 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16641 | { |
| 16642 | unsigned int present; |
| 16643 | unsigned char bits; |
| 16644 | |
| 16645 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16646 | AC_VERB_GET_PIN_SENSE, 0) |
| 16647 | & AC_PINSENSE_PRESENCE; |
| 16648 | bits = present ? HDA_AMP_MUTE : 0; |
| 16649 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16650 | HDA_AMP_MUTE, bits); |
| 16651 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16652 | HDA_AMP_MUTE, bits); |
| 16653 | } |
| 16654 | |
| 16655 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16656 | { |
| 16657 | unsigned int present; |
| 16658 | unsigned char bits; |
| 16659 | |
| 16660 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16661 | AC_VERB_GET_PIN_SENSE, 0) |
| 16662 | & AC_PINSENSE_PRESENCE; |
| 16663 | bits = present ? HDA_AMP_MUTE : 0; |
| 16664 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16665 | HDA_AMP_MUTE, bits); |
| 16666 | } |
| 16667 | |
| 16668 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16669 | unsigned int res) |
| 16670 | { |
| 16671 | switch (res >> 26) { |
| 16672 | case ALC880_HP_EVENT: |
| 16673 | alc663_g71v_hp_automute(codec); |
| 16674 | break; |
| 16675 | case ALC880_FRONT_EVENT: |
| 16676 | alc663_g71v_front_automute(codec); |
| 16677 | break; |
| 16678 | case ALC880_MIC_EVENT: |
| 16679 | alc662_eeepc_mic_automute(codec); |
| 16680 | break; |
| 16681 | } |
| 16682 | } |
| 16683 | |
| 16684 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16685 | { |
| 16686 | alc663_g71v_front_automute(codec); |
| 16687 | alc663_g71v_hp_automute(codec); |
| 16688 | alc662_eeepc_mic_automute(codec); |
| 16689 | } |
| 16690 | |
| 16691 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16692 | unsigned int res) |
| 16693 | { |
| 16694 | switch (res >> 26) { |
| 16695 | case ALC880_HP_EVENT: |
| 16696 | alc663_m51va_speaker_automute(codec); |
| 16697 | break; |
| 16698 | case ALC880_MIC_EVENT: |
| 16699 | alc662_eeepc_mic_automute(codec); |
| 16700 | break; |
| 16701 | } |
| 16702 | } |
| 16703 | |
| 16704 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16705 | { |
| 16706 | alc663_m51va_speaker_automute(codec); |
| 16707 | alc662_eeepc_mic_automute(codec); |
| 16708 | } |
| 16709 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16710 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16711 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16712 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16713 | |
| 16714 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16715 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16716 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16717 | |
| 16718 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16719 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16720 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16721 | { } /* end */ |
| 16722 | }; |
| 16723 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16724 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16725 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16726 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16727 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16728 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16729 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16730 | |
| 16731 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16732 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16733 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16734 | |
| 16735 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16736 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16737 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16738 | { } /* end */ |
| 16739 | }; |
| 16740 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16741 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16742 | #define alc662_loopbacks alc880_loopbacks |
| 16743 | #endif |
| 16744 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16745 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16746 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16747 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16748 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16749 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16750 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16751 | |
| 16752 | /* |
| 16753 | * configuration and preset |
| 16754 | */ |
| 16755 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16756 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16757 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16758 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16759 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16760 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16761 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16762 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16763 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16764 | [ALC663_ASUS_M51VA] = "m51va", |
| 16765 | [ALC663_ASUS_G71V] = "g71v", |
| 16766 | [ALC663_ASUS_H13] = "h13", |
| 16767 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16768 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16769 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16770 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16771 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16772 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16773 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16774 | [ALC272_DELL] = "dell", |
| 16775 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16776 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16777 | [ALC662_AUTO] = "auto", |
| 16778 | }; |
| 16779 | |
| 16780 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16781 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16782 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16783 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16784 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16785 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16786 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16787 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16788 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16789 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16790 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16791 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16792 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16793 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16794 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16795 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16796 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16797 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16798 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16799 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16800 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16801 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16802 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16803 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16804 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16805 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16806 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16807 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16808 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16809 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16810 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16811 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16812 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16813 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16814 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16815 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16816 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16817 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16818 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16819 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16820 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16821 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16822 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16823 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16824 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16825 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16826 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16827 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16828 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16829 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16830 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16831 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16832 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16833 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16834 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16835 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16836 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16837 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16838 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16839 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16840 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16841 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16842 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16843 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16844 | {} |
| 16845 | }; |
| 16846 | |
| 16847 | static struct alc_config_preset alc662_presets[] = { |
| 16848 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16849 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16850 | .init_verbs = { alc662_init_verbs }, |
| 16851 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16852 | .dac_nids = alc662_dac_nids, |
| 16853 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16854 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16855 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16856 | .channel_mode = alc662_3ST_2ch_modes, |
| 16857 | .input_mux = &alc662_capture_source, |
| 16858 | }, |
| 16859 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16860 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16861 | .init_verbs = { alc662_init_verbs }, |
| 16862 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16863 | .dac_nids = alc662_dac_nids, |
| 16864 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16865 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16866 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16867 | .channel_mode = alc662_3ST_6ch_modes, |
| 16868 | .need_dac_fix = 1, |
| 16869 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16870 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16871 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16872 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16873 | .init_verbs = { alc662_init_verbs }, |
| 16874 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16875 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16876 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16877 | .channel_mode = alc662_3ST_6ch_modes, |
| 16878 | .need_dac_fix = 1, |
| 16879 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16880 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16881 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16882 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16883 | .init_verbs = { alc662_init_verbs }, |
| 16884 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16885 | .dac_nids = alc662_dac_nids, |
| 16886 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16887 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16888 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16889 | .channel_mode = alc662_5stack_modes, |
| 16890 | .input_mux = &alc662_capture_source, |
| 16891 | }, |
| 16892 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16893 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16894 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16895 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16896 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16897 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16898 | .channel_mode = alc662_3ST_2ch_modes, |
| 16899 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16900 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16901 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16902 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16903 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16904 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16905 | .init_verbs = { alc662_init_verbs, |
| 16906 | alc662_eeepc_sue_init_verbs }, |
| 16907 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16908 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16909 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16910 | .channel_mode = alc662_3ST_2ch_modes, |
| 16911 | .input_mux = &alc662_eeepc_capture_source, |
| 16912 | .unsol_event = alc662_eeepc_unsol_event, |
| 16913 | .init_hook = alc662_eeepc_inithook, |
| 16914 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16915 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16916 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16917 | alc662_chmode_mixer }, |
| 16918 | .init_verbs = { alc662_init_verbs, |
| 16919 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16920 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16921 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16922 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16923 | .channel_mode = alc662_3ST_6ch_modes, |
| 16924 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16925 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16926 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16927 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16928 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16929 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16930 | .init_verbs = { alc662_init_verbs, |
| 16931 | alc662_ecs_init_verbs }, |
| 16932 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16933 | .dac_nids = alc662_dac_nids, |
| 16934 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16935 | .channel_mode = alc662_3ST_2ch_modes, |
| 16936 | .input_mux = &alc662_eeepc_capture_source, |
| 16937 | .unsol_event = alc662_eeepc_unsol_event, |
| 16938 | .init_hook = alc662_eeepc_inithook, |
| 16939 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16940 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16941 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16942 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16943 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16944 | .dac_nids = alc662_dac_nids, |
| 16945 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16946 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16947 | .channel_mode = alc662_3ST_2ch_modes, |
| 16948 | .input_mux = &alc663_m51va_capture_source, |
| 16949 | .unsol_event = alc663_m51va_unsol_event, |
| 16950 | .init_hook = alc663_m51va_inithook, |
| 16951 | }, |
| 16952 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16953 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16954 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16955 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16956 | .dac_nids = alc662_dac_nids, |
| 16957 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16958 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16959 | .channel_mode = alc662_3ST_2ch_modes, |
| 16960 | .input_mux = &alc662_eeepc_capture_source, |
| 16961 | .unsol_event = alc663_g71v_unsol_event, |
| 16962 | .init_hook = alc663_g71v_inithook, |
| 16963 | }, |
| 16964 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16965 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16966 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16967 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16968 | .dac_nids = alc662_dac_nids, |
| 16969 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16970 | .channel_mode = alc662_3ST_2ch_modes, |
| 16971 | .input_mux = &alc663_m51va_capture_source, |
| 16972 | .unsol_event = alc663_m51va_unsol_event, |
| 16973 | .init_hook = alc663_m51va_inithook, |
| 16974 | }, |
| 16975 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16976 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16977 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16978 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16979 | .dac_nids = alc662_dac_nids, |
| 16980 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16981 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16982 | .channel_mode = alc662_3ST_6ch_modes, |
| 16983 | .input_mux = &alc663_capture_source, |
| 16984 | .unsol_event = alc663_g50v_unsol_event, |
| 16985 | .init_hook = alc663_g50v_inithook, |
| 16986 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16987 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16988 | .mixers = { alc663_m51va_mixer }, |
| 16989 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16990 | .init_verbs = { alc662_init_verbs, |
| 16991 | alc663_21jd_amic_init_verbs }, |
| 16992 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16993 | .hp_nid = 0x03, |
| 16994 | .dac_nids = alc662_dac_nids, |
| 16995 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16996 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16997 | .channel_mode = alc662_3ST_2ch_modes, |
| 16998 | .input_mux = &alc662_eeepc_capture_source, |
| 16999 | .unsol_event = alc663_mode1_unsol_event, |
| 17000 | .init_hook = alc663_mode1_inithook, |
| 17001 | }, |
| 17002 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17003 | .mixers = { alc662_1bjd_mixer }, |
| 17004 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17005 | .init_verbs = { alc662_init_verbs, |
| 17006 | alc662_1bjd_amic_init_verbs }, |
| 17007 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17008 | .dac_nids = alc662_dac_nids, |
| 17009 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17010 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17011 | .channel_mode = alc662_3ST_2ch_modes, |
| 17012 | .input_mux = &alc662_eeepc_capture_source, |
| 17013 | .unsol_event = alc662_mode2_unsol_event, |
| 17014 | .init_hook = alc662_mode2_inithook, |
| 17015 | }, |
| 17016 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17017 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17018 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17019 | .init_verbs = { alc662_init_verbs, |
| 17020 | alc663_two_hp_amic_m1_init_verbs }, |
| 17021 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17022 | .hp_nid = 0x03, |
| 17023 | .dac_nids = alc662_dac_nids, |
| 17024 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17025 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17026 | .channel_mode = alc662_3ST_2ch_modes, |
| 17027 | .input_mux = &alc662_eeepc_capture_source, |
| 17028 | .unsol_event = alc663_mode3_unsol_event, |
| 17029 | .init_hook = alc663_mode3_inithook, |
| 17030 | }, |
| 17031 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17032 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17033 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17034 | .init_verbs = { alc662_init_verbs, |
| 17035 | alc663_21jd_amic_init_verbs}, |
| 17036 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17037 | .hp_nid = 0x03, |
| 17038 | .dac_nids = alc662_dac_nids, |
| 17039 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17040 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17041 | .channel_mode = alc662_3ST_2ch_modes, |
| 17042 | .input_mux = &alc662_eeepc_capture_source, |
| 17043 | .unsol_event = alc663_mode4_unsol_event, |
| 17044 | .init_hook = alc663_mode4_inithook, |
| 17045 | }, |
| 17046 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17047 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17048 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17049 | .init_verbs = { alc662_init_verbs, |
| 17050 | alc663_15jd_amic_init_verbs }, |
| 17051 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17052 | .hp_nid = 0x03, |
| 17053 | .dac_nids = alc662_dac_nids, |
| 17054 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17055 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17056 | .channel_mode = alc662_3ST_2ch_modes, |
| 17057 | .input_mux = &alc662_eeepc_capture_source, |
| 17058 | .unsol_event = alc663_mode5_unsol_event, |
| 17059 | .init_hook = alc663_mode5_inithook, |
| 17060 | }, |
| 17061 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17062 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17063 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17064 | .init_verbs = { alc662_init_verbs, |
| 17065 | alc663_two_hp_amic_m2_init_verbs }, |
| 17066 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17067 | .hp_nid = 0x03, |
| 17068 | .dac_nids = alc662_dac_nids, |
| 17069 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17070 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17071 | .channel_mode = alc662_3ST_2ch_modes, |
| 17072 | .input_mux = &alc662_eeepc_capture_source, |
| 17073 | .unsol_event = alc663_mode6_unsol_event, |
| 17074 | .init_hook = alc663_mode6_inithook, |
| 17075 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17076 | [ALC272_DELL] = { |
| 17077 | .mixers = { alc663_m51va_mixer }, |
| 17078 | .cap_mixer = alc272_auto_capture_mixer, |
| 17079 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17080 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17081 | .dac_nids = alc662_dac_nids, |
| 17082 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17083 | .adc_nids = alc272_adc_nids, |
| 17084 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17085 | .capsrc_nids = alc272_capsrc_nids, |
| 17086 | .channel_mode = alc662_3ST_2ch_modes, |
| 17087 | .input_mux = &alc663_m51va_capture_source, |
| 17088 | .unsol_event = alc663_m51va_unsol_event, |
| 17089 | .init_hook = alc663_m51va_inithook, |
| 17090 | }, |
| 17091 | [ALC272_DELL_ZM1] = { |
| 17092 | .mixers = { alc663_m51va_mixer }, |
| 17093 | .cap_mixer = alc662_auto_capture_mixer, |
| 17094 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17095 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17096 | .dac_nids = alc662_dac_nids, |
| 17097 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17098 | .adc_nids = alc662_adc_nids, |
| 17099 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 17100 | .capsrc_nids = alc662_capsrc_nids, |
| 17101 | .channel_mode = alc662_3ST_2ch_modes, |
| 17102 | .input_mux = &alc663_m51va_capture_source, |
| 17103 | .unsol_event = alc663_m51va_unsol_event, |
| 17104 | .init_hook = alc663_m51va_inithook, |
| 17105 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17106 | [ALC272_SAMSUNG_NC10] = { |
| 17107 | .mixers = { alc272_nc10_mixer }, |
| 17108 | .init_verbs = { alc662_init_verbs, |
| 17109 | alc663_21jd_amic_init_verbs }, |
| 17110 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17111 | .dac_nids = alc272_dac_nids, |
| 17112 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17113 | .channel_mode = alc662_3ST_2ch_modes, |
| 17114 | .input_mux = &alc272_nc10_capture_source, |
| 17115 | .unsol_event = alc663_mode4_unsol_event, |
| 17116 | .init_hook = alc663_mode4_inithook, |
| 17117 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17118 | }; |
| 17119 | |
| 17120 | |
| 17121 | /* |
| 17122 | * BIOS auto configuration |
| 17123 | */ |
| 17124 | |
| 17125 | /* add playback controls from the parsed DAC table */ |
| 17126 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17127 | const struct auto_pin_cfg *cfg) |
| 17128 | { |
| 17129 | char name[32]; |
| 17130 | static const char *chname[4] = { |
| 17131 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17132 | }; |
| 17133 | hda_nid_t nid; |
| 17134 | int i, err; |
| 17135 | |
| 17136 | for (i = 0; i < cfg->line_outs; i++) { |
| 17137 | if (!spec->multiout.dac_nids[i]) |
| 17138 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17139 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17140 | if (i == 2) { |
| 17141 | /* Center/LFE */ |
| 17142 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17143 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17144 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17145 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17146 | if (err < 0) |
| 17147 | return err; |
| 17148 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17149 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17150 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17151 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17152 | if (err < 0) |
| 17153 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17154 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17155 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17156 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17157 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17158 | if (err < 0) |
| 17159 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17160 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17161 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17162 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17163 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17164 | if (err < 0) |
| 17165 | return err; |
| 17166 | } else { |
| 17167 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17168 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17169 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17170 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17171 | if (err < 0) |
| 17172 | return err; |
| 17173 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17174 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17175 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17176 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17177 | if (err < 0) |
| 17178 | return err; |
| 17179 | } |
| 17180 | } |
| 17181 | return 0; |
| 17182 | } |
| 17183 | |
| 17184 | /* add playback controls for speaker and HP outputs */ |
| 17185 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17186 | const char *pfx) |
| 17187 | { |
| 17188 | hda_nid_t nid; |
| 17189 | int err; |
| 17190 | char name[32]; |
| 17191 | |
| 17192 | if (!pin) |
| 17193 | return 0; |
| 17194 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17195 | if (pin == 0x17) { |
| 17196 | /* ALC663 has a mono output pin on 0x17 */ |
| 17197 | sprintf(name, "%s Playback Switch", pfx); |
| 17198 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17199 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17200 | return err; |
| 17201 | } |
| 17202 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17203 | if (alc880_is_fixed_pin(pin)) { |
| 17204 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17205 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17206 | /* specify the DAC as the extra output */ |
| 17207 | if (!spec->multiout.hp_nid) |
| 17208 | spec->multiout.hp_nid = nid; |
| 17209 | else |
| 17210 | spec->multiout.extra_out_nid[0] = nid; |
| 17211 | /* control HP volume/switch on the output mixer amp */ |
| 17212 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17213 | sprintf(name, "%s Playback Volume", pfx); |
| 17214 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17215 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17216 | if (err < 0) |
| 17217 | return err; |
| 17218 | sprintf(name, "%s Playback Switch", pfx); |
| 17219 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17220 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17221 | if (err < 0) |
| 17222 | return err; |
| 17223 | } else if (alc880_is_multi_pin(pin)) { |
| 17224 | /* set manual connection */ |
| 17225 | /* we have only a switch on HP-out PIN */ |
| 17226 | sprintf(name, "%s Playback Switch", pfx); |
| 17227 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17228 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17229 | if (err < 0) |
| 17230 | return err; |
| 17231 | } |
| 17232 | return 0; |
| 17233 | } |
| 17234 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17235 | /* return the index of the src widget from the connection list of the nid. |
| 17236 | * return -1 if not found |
| 17237 | */ |
| 17238 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 17239 | hda_nid_t src) |
| 17240 | { |
| 17241 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 17242 | int i, conns; |
| 17243 | |
| 17244 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 17245 | ARRAY_SIZE(conn_list)); |
| 17246 | if (conns < 0) |
| 17247 | return -1; |
| 17248 | for (i = 0; i < conns; i++) |
| 17249 | if (conn_list[i] == src) |
| 17250 | return i; |
| 17251 | return -1; |
| 17252 | } |
| 17253 | |
| 17254 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17255 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17256 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17257 | return (pincap & AC_PINCAP_IN) != 0; |
| 17258 | } |
| 17259 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17260 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17261 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17262 | const struct auto_pin_cfg *cfg) |
| 17263 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17264 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17265 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17266 | int i, err, idx; |
| 17267 | |
| 17268 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17269 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 17270 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 17271 | cfg->input_pins[i]); |
| 17272 | if (idx >= 0) { |
| 17273 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17274 | auto_pin_cfg_labels[i], |
| 17275 | idx, 0x0b); |
| 17276 | if (err < 0) |
| 17277 | return err; |
| 17278 | } |
| 17279 | idx = alc662_input_pin_idx(codec, 0x22, |
| 17280 | cfg->input_pins[i]); |
| 17281 | if (idx >= 0) { |
| 17282 | imux->items[imux->num_items].label = |
| 17283 | auto_pin_cfg_labels[i]; |
| 17284 | imux->items[imux->num_items].index = idx; |
| 17285 | imux->num_items++; |
| 17286 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17287 | } |
| 17288 | } |
| 17289 | return 0; |
| 17290 | } |
| 17291 | |
| 17292 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17293 | hda_nid_t nid, int pin_type, |
| 17294 | int dac_idx) |
| 17295 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17296 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17297 | /* need the manual connection? */ |
| 17298 | if (alc880_is_multi_pin(nid)) { |
| 17299 | struct alc_spec *spec = codec->spec; |
| 17300 | int idx = alc880_multi_pin_idx(nid); |
| 17301 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17302 | AC_VERB_SET_CONNECT_SEL, |
| 17303 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17304 | } |
| 17305 | } |
| 17306 | |
| 17307 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17308 | { |
| 17309 | struct alc_spec *spec = codec->spec; |
| 17310 | int i; |
| 17311 | |
| 17312 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17313 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17314 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17315 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17316 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17317 | i); |
| 17318 | } |
| 17319 | } |
| 17320 | |
| 17321 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17322 | { |
| 17323 | struct alc_spec *spec = codec->spec; |
| 17324 | hda_nid_t pin; |
| 17325 | |
| 17326 | pin = spec->autocfg.hp_pins[0]; |
| 17327 | if (pin) /* connect to front */ |
| 17328 | /* use dac 0 */ |
| 17329 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17330 | pin = spec->autocfg.speaker_pins[0]; |
| 17331 | if (pin) |
| 17332 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17333 | } |
| 17334 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17335 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17336 | |
| 17337 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17338 | { |
| 17339 | struct alc_spec *spec = codec->spec; |
| 17340 | int i; |
| 17341 | |
| 17342 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17343 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17344 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17345 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17346 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17347 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17348 | snd_hda_codec_write(codec, nid, 0, |
| 17349 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17350 | AMP_OUT_MUTE); |
| 17351 | } |
| 17352 | } |
| 17353 | } |
| 17354 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17355 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17356 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17357 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17358 | { |
| 17359 | struct alc_spec *spec = codec->spec; |
| 17360 | int err; |
| 17361 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17362 | |
| 17363 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17364 | alc662_ignore); |
| 17365 | if (err < 0) |
| 17366 | return err; |
| 17367 | if (!spec->autocfg.line_outs) |
| 17368 | return 0; /* can't find valid BIOS pin config */ |
| 17369 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17370 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17371 | if (err < 0) |
| 17372 | return err; |
| 17373 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17374 | if (err < 0) |
| 17375 | return err; |
| 17376 | err = alc662_auto_create_extra_out(spec, |
| 17377 | spec->autocfg.speaker_pins[0], |
| 17378 | "Speaker"); |
| 17379 | if (err < 0) |
| 17380 | return err; |
| 17381 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17382 | "Headphone"); |
| 17383 | if (err < 0) |
| 17384 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17385 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17386 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17387 | return err; |
| 17388 | |
| 17389 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17390 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17391 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17392 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17393 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17394 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17395 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17396 | |
| 17397 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17398 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17399 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17400 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17401 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17402 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17403 | |
| 17404 | err = alc_auto_add_mic_boost(codec); |
| 17405 | if (err < 0) |
| 17406 | return err; |
| 17407 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17408 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17409 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17410 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17411 | } |
| 17412 | |
| 17413 | /* additional initialization for auto-configuration model */ |
| 17414 | static void alc662_auto_init(struct hda_codec *codec) |
| 17415 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17416 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17417 | alc662_auto_init_multi_out(codec); |
| 17418 | alc662_auto_init_hp_out(codec); |
| 17419 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17420 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17421 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17422 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17423 | } |
| 17424 | |
| 17425 | static int patch_alc662(struct hda_codec *codec) |
| 17426 | { |
| 17427 | struct alc_spec *spec; |
| 17428 | int err, board_config; |
| 17429 | |
| 17430 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17431 | if (!spec) |
| 17432 | return -ENOMEM; |
| 17433 | |
| 17434 | codec->spec = spec; |
| 17435 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17436 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17437 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17438 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17439 | alc662_models, |
| 17440 | alc662_cfg_tbl); |
| 17441 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 17442 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 17443 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17444 | board_config = ALC662_AUTO; |
| 17445 | } |
| 17446 | |
| 17447 | if (board_config == ALC662_AUTO) { |
| 17448 | /* automatic parse from the BIOS config */ |
| 17449 | err = alc662_parse_auto_config(codec); |
| 17450 | if (err < 0) { |
| 17451 | alc_free(codec); |
| 17452 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17453 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17454 | printk(KERN_INFO |
| 17455 | "hda_codec: Cannot set up configuration " |
| 17456 | "from BIOS. Using base mode...\n"); |
| 17457 | board_config = ALC662_3ST_2ch_DIG; |
| 17458 | } |
| 17459 | } |
| 17460 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17461 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17462 | if (err < 0) { |
| 17463 | alc_free(codec); |
| 17464 | return err; |
| 17465 | } |
| 17466 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17467 | if (board_config != ALC662_AUTO) |
| 17468 | setup_preset(spec, &alc662_presets[board_config]); |
| 17469 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17470 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17471 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17472 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17473 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17474 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17475 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17476 | spec->adc_nids = alc662_adc_nids; |
| 17477 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17478 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17479 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17480 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17481 | if (!spec->cap_mixer) |
| 17482 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17483 | if (codec->vendor_id == 0x10ec0662) |
| 17484 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17485 | else |
| 17486 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17487 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17488 | spec->vmaster_nid = 0x02; |
| 17489 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17490 | codec->patch_ops = alc_patch_ops; |
| 17491 | if (board_config == ALC662_AUTO) |
| 17492 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17493 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17494 | if (!spec->loopback.amplist) |
| 17495 | spec->loopback.amplist = alc662_loopbacks; |
| 17496 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17497 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17498 | |
| 17499 | return 0; |
| 17500 | } |
| 17501 | |
| 17502 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17503 | * patch entries |
| 17504 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17505 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17506 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17507 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17508 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17509 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17510 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17511 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17512 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17513 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17514 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17515 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17516 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17517 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 17518 | .patch = patch_alc883 }, |
| 17519 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17520 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17521 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17522 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17523 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17524 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17525 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17526 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17527 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17528 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17529 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17530 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17531 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17532 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17533 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17534 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17535 | {} /* terminator */ |
| 17536 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17537 | |
| 17538 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17539 | |
| 17540 | MODULE_LICENSE("GPL"); |
| 17541 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17542 | |
| 17543 | static struct hda_codec_preset_list realtek_list = { |
| 17544 | .preset = snd_hda_preset_realtek, |
| 17545 | .owner = THIS_MODULE, |
| 17546 | }; |
| 17547 | |
| 17548 | static int __init patch_realtek_init(void) |
| 17549 | { |
| 17550 | return snd_hda_add_codec_preset(&realtek_list); |
| 17551 | } |
| 17552 | |
| 17553 | static void __exit patch_realtek_exit(void) |
| 17554 | { |
| 17555 | snd_hda_delete_codec_preset(&realtek_list); |
| 17556 | } |
| 17557 | |
| 17558 | module_init(patch_realtek_init) |
| 17559 | module_exit(patch_realtek_exit) |