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> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 285 | struct alc_jack { |
| 286 | hda_nid_t nid; |
| 287 | int type; |
| 288 | struct snd_jack *jack; |
| 289 | }; |
| 290 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 291 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 292 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 293 | struct alc_customize_define { |
| 294 | unsigned int sku_cfg; |
| 295 | unsigned char port_connectivity; |
| 296 | unsigned char check_sum; |
| 297 | unsigned char customization; |
| 298 | unsigned char external_amp; |
| 299 | unsigned int enable_pcbeep:1; |
| 300 | unsigned int platform_type:1; |
| 301 | unsigned int swap:1; |
| 302 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 303 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 304 | }; |
| 305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | struct alc_spec { |
| 307 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 308 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 310 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 311 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 313 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 314 | * don't forget NULL |
| 315 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 316 | */ |
| 317 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 319 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | struct hda_pcm_stream *stream_analog_playback; |
| 321 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 322 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 323 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 325 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | struct hda_pcm_stream *stream_digital_playback; |
| 327 | struct hda_pcm_stream *stream_digital_capture; |
| 328 | |
| 329 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 330 | struct hda_multi_out multiout; /* playback set-up |
| 331 | * max_channels, dacs must be set |
| 332 | * dig_out_nid and hp_nid are optional |
| 333 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 334 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 335 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 336 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | |
| 338 | /* capture */ |
| 339 | unsigned int num_adc_nids; |
| 340 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 341 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 342 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 344 | /* capture setup for dynamic dual-adc switch */ |
| 345 | unsigned int cur_adc_idx; |
| 346 | hda_nid_t cur_adc; |
| 347 | unsigned int cur_adc_stream_tag; |
| 348 | unsigned int cur_adc_format; |
| 349 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 351 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | const struct hda_input_mux *input_mux; |
| 353 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 354 | struct alc_mic_route ext_mic; |
| 355 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | |
| 357 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 358 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 360 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 361 | int const_channel_count; |
| 362 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | |
| 364 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 365 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 366 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 367 | /* jack detection */ |
| 368 | struct snd_array jacks; |
| 369 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 370 | /* dynamic controls, init_verbs and input_mux */ |
| 371 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 372 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 373 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 374 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 375 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 376 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 377 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 378 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 379 | /* hooks */ |
| 380 | void (*init_hook)(struct hda_codec *codec); |
| 381 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 382 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 383 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 384 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 385 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 386 | /* for pin sensing */ |
| 387 | unsigned int sense_updated: 1; |
| 388 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 389 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 390 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 391 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 392 | /* other flags */ |
| 393 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 394 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 395 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 396 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 397 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 398 | /* for virtual master */ |
| 399 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 400 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 401 | struct hda_loopback_check loopback; |
| 402 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 403 | |
| 404 | /* for PLL fix */ |
| 405 | hda_nid_t pll_nid; |
| 406 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 407 | }; |
| 408 | |
| 409 | /* |
| 410 | * configuration template - to be copied to the spec instance |
| 411 | */ |
| 412 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 413 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 414 | * with spec |
| 415 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 416 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 417 | const struct hda_verb *init_verbs[5]; |
| 418 | unsigned int num_dacs; |
| 419 | hda_nid_t *dac_nids; |
| 420 | hda_nid_t dig_out_nid; /* optional */ |
| 421 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 422 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 423 | unsigned int num_adc_nids; |
| 424 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 425 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 426 | hda_nid_t dig_in_nid; |
| 427 | unsigned int num_channel_mode; |
| 428 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 429 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 430 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 431 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 432 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 433 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 434 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 435 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 436 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 437 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 438 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 439 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | }; |
| 441 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | |
| 443 | /* |
| 444 | * input MUX handling |
| 445 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 446 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 447 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | { |
| 449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 450 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 451 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 452 | if (mux_idx >= spec->num_mux_defs) |
| 453 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 454 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 455 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 456 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | } |
| 458 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 460 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | { |
| 462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 463 | struct alc_spec *spec = codec->spec; |
| 464 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 465 | |
| 466 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 467 | return 0; |
| 468 | } |
| 469 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 471 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | { |
| 473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 474 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 475 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 477 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 478 | hda_nid_t nid = spec->capsrc_nids ? |
| 479 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 480 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 482 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 483 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 484 | if (!imux->num_items && mux_idx > 0) |
| 485 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 486 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 487 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 488 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 489 | /* Matrix-mixer style (e.g. ALC882) */ |
| 490 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 491 | unsigned int i, idx; |
| 492 | |
| 493 | idx = ucontrol->value.enumerated.item[0]; |
| 494 | if (idx >= imux->num_items) |
| 495 | idx = imux->num_items - 1; |
| 496 | if (*cur_val == idx) |
| 497 | return 0; |
| 498 | for (i = 0; i < imux->num_items; i++) { |
| 499 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 500 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 501 | imux->items[i].index, |
| 502 | HDA_AMP_MUTE, v); |
| 503 | } |
| 504 | *cur_val = idx; |
| 505 | return 1; |
| 506 | } else { |
| 507 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 508 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 509 | &spec->cur_mux[adc_idx]); |
| 510 | } |
| 511 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 512 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | /* |
| 514 | * channel mode setting |
| 515 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 516 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 517 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | { |
| 519 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 520 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 521 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 522 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | } |
| 524 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 525 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 526 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | { |
| 528 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 529 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 530 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 531 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 532 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | } |
| 534 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 535 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 536 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | { |
| 538 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 539 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 540 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 541 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 542 | &spec->ext_channel_count); |
| 543 | if (err >= 0 && !spec->const_channel_count) { |
| 544 | spec->multiout.max_channels = spec->ext_channel_count; |
| 545 | if (spec->need_dac_fix) |
| 546 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 547 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 548 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | } |
| 550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | * 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] | 553 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 554 | * being part of a format specifier. Maximum allowed length of a value is |
| 555 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 556 | * |
| 557 | * Note: some retasking pin complexes seem to ignore requests for input |
| 558 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 559 | * are requested. Therefore order this list so that this behaviour will not |
| 560 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 561 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 562 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 563 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 564 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 565 | "Mic 50pc bias", "Mic 80pc bias", |
| 566 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 567 | }; |
| 568 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 569 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 570 | }; |
| 571 | /* 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] | 572 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 573 | * addition, "input" pins may or may not process the mic bias option |
| 574 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 575 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 576 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 578 | #define ALC_PIN_DIR_IN 0x00 |
| 579 | #define ALC_PIN_DIR_OUT 0x01 |
| 580 | #define ALC_PIN_DIR_INOUT 0x02 |
| 581 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 582 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 583 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 584 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 585 | * For each direction the minimum and maximum values are given. |
| 586 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 587 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 588 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 589 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 590 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 591 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 592 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 593 | }; |
| 594 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 595 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 596 | #define alc_pin_mode_n_items(_dir) \ |
| 597 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 598 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 599 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 600 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 601 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 602 | unsigned int item_num = uinfo->value.enumerated.item; |
| 603 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 604 | |
| 605 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 606 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 607 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 608 | |
| 609 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 610 | item_num = alc_pin_mode_min(dir); |
| 611 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 612 | return 0; |
| 613 | } |
| 614 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 615 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 616 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 617 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 618 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 620 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 621 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 622 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 624 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 625 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 626 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 627 | /* Find enumerated value for current pinctl setting */ |
| 628 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 629 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 630 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 631 | *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] | 632 | return 0; |
| 633 | } |
| 634 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 635 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 636 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 637 | { |
| 638 | signed int change; |
| 639 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 640 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 641 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 642 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 643 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 644 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 645 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 646 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 647 | 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] | 648 | val = alc_pin_mode_min(dir); |
| 649 | |
| 650 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 651 | if (change) { |
| 652 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 653 | snd_hda_codec_write_cache(codec, nid, 0, |
| 654 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 655 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 656 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 657 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 658 | * for the requested pin mode. Enum values of 2 or less are |
| 659 | * input modes. |
| 660 | * |
| 661 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 662 | * reduces noise slightly (particularly on input) so we'll |
| 663 | * do it. However, having both input and output buffers |
| 664 | * enabled simultaneously doesn't seem to be problematic if |
| 665 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 666 | */ |
| 667 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 668 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 669 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 670 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 671 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 672 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 673 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 674 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 675 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 676 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 677 | } |
| 678 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 679 | return change; |
| 680 | } |
| 681 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 682 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 683 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 684 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 685 | .info = alc_pin_mode_info, \ |
| 686 | .get = alc_pin_mode_get, \ |
| 687 | .put = alc_pin_mode_put, \ |
| 688 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 689 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 690 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 691 | * together using a mask with more than one bit set. This control is |
| 692 | * currently used only by the ALC260 test model. At this stage they are not |
| 693 | * needed for any "production" models. |
| 694 | */ |
| 695 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 696 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 697 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 698 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 699 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 700 | { |
| 701 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 702 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 703 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 704 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 705 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 706 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 707 | |
| 708 | *valp = (val & mask) != 0; |
| 709 | return 0; |
| 710 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 711 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 712 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 713 | { |
| 714 | signed int change; |
| 715 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 716 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 717 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 718 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 719 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 720 | AC_VERB_GET_GPIO_DATA, |
| 721 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 722 | |
| 723 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 724 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 725 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 726 | gpio_data &= ~mask; |
| 727 | else |
| 728 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 729 | snd_hda_codec_write_cache(codec, nid, 0, |
| 730 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 731 | |
| 732 | return change; |
| 733 | } |
| 734 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 735 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 736 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 737 | .info = alc_gpio_data_info, \ |
| 738 | .get = alc_gpio_data_get, \ |
| 739 | .put = alc_gpio_data_put, \ |
| 740 | .private_value = nid | (mask<<16) } |
| 741 | #endif /* CONFIG_SND_DEBUG */ |
| 742 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 743 | /* A switch control to allow the enabling of the digital IO pins on the |
| 744 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 745 | * to provide something in the test model allowing digital outputs to be |
| 746 | * identified if present. If models are found which can utilise these |
| 747 | * outputs a more complete mixer control can be devised for those models if |
| 748 | * necessary. |
| 749 | */ |
| 750 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 751 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 752 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 753 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 754 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 755 | { |
| 756 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 757 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 758 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 759 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 760 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 761 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 762 | |
| 763 | *valp = (val & mask) != 0; |
| 764 | return 0; |
| 765 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 766 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 767 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 768 | { |
| 769 | signed int change; |
| 770 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 771 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 772 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 773 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 774 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 775 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 776 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 777 | |
| 778 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 779 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 780 | if (val==0) |
| 781 | ctrl_data &= ~mask; |
| 782 | else |
| 783 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 784 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 785 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 786 | |
| 787 | return change; |
| 788 | } |
| 789 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 790 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 791 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 792 | .info = alc_spdif_ctrl_info, \ |
| 793 | .get = alc_spdif_ctrl_get, \ |
| 794 | .put = alc_spdif_ctrl_put, \ |
| 795 | .private_value = nid | (mask<<16) } |
| 796 | #endif /* CONFIG_SND_DEBUG */ |
| 797 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 798 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 799 | * Again, this is only used in the ALC26x test models to help identify when |
| 800 | * the EAPD line must be asserted for features to work. |
| 801 | */ |
| 802 | #ifdef CONFIG_SND_DEBUG |
| 803 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 804 | |
| 805 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 806 | struct snd_ctl_elem_value *ucontrol) |
| 807 | { |
| 808 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 809 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 810 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 811 | long *valp = ucontrol->value.integer.value; |
| 812 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 813 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 814 | |
| 815 | *valp = (val & mask) != 0; |
| 816 | return 0; |
| 817 | } |
| 818 | |
| 819 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 820 | struct snd_ctl_elem_value *ucontrol) |
| 821 | { |
| 822 | int change; |
| 823 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 824 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 825 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 826 | long val = *ucontrol->value.integer.value; |
| 827 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 828 | AC_VERB_GET_EAPD_BTLENABLE, |
| 829 | 0x00); |
| 830 | |
| 831 | /* Set/unset the masked control bit(s) as needed */ |
| 832 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 833 | if (!val) |
| 834 | ctrl_data &= ~mask; |
| 835 | else |
| 836 | ctrl_data |= mask; |
| 837 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 838 | ctrl_data); |
| 839 | |
| 840 | return change; |
| 841 | } |
| 842 | |
| 843 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 844 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 845 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 846 | .info = alc_eapd_ctrl_info, \ |
| 847 | .get = alc_eapd_ctrl_get, \ |
| 848 | .put = alc_eapd_ctrl_put, \ |
| 849 | .private_value = nid | (mask<<16) } |
| 850 | #endif /* CONFIG_SND_DEBUG */ |
| 851 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 852 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 853 | * set up the input pin config (depending on the given auto-pin type) |
| 854 | */ |
| 855 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 856 | int auto_pin_type) |
| 857 | { |
| 858 | unsigned int val = PIN_IN; |
| 859 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 860 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 861 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 862 | unsigned int oldval; |
| 863 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 864 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 865 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 866 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 867 | /* if the default pin setup is vref50, we give it priority */ |
| 868 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 869 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 870 | else if (pincap & AC_PINCAP_VREF_50) |
| 871 | val = PIN_VREF50; |
| 872 | else if (pincap & AC_PINCAP_VREF_100) |
| 873 | val = PIN_VREF100; |
| 874 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 875 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 876 | } |
| 877 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 878 | } |
| 879 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 880 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 881 | { |
| 882 | struct alc_spec *spec = codec->spec; |
| 883 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 884 | |
| 885 | if (!cfg->line_outs) { |
| 886 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 887 | cfg->line_out_pins[cfg->line_outs]) |
| 888 | cfg->line_outs++; |
| 889 | } |
| 890 | if (!cfg->speaker_outs) { |
| 891 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 892 | cfg->speaker_pins[cfg->speaker_outs]) |
| 893 | cfg->speaker_outs++; |
| 894 | } |
| 895 | if (!cfg->hp_outs) { |
| 896 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 897 | cfg->hp_pins[cfg->hp_outs]) |
| 898 | cfg->hp_outs++; |
| 899 | } |
| 900 | } |
| 901 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 902 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 903 | */ |
| 904 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 905 | { |
| 906 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 907 | return; |
| 908 | spec->mixers[spec->num_mixers++] = mix; |
| 909 | } |
| 910 | |
| 911 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 912 | { |
| 913 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 914 | return; |
| 915 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 916 | } |
| 917 | |
| 918 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 919 | * set up from the preset table |
| 920 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 921 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 922 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 923 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 924 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 925 | int i; |
| 926 | |
| 927 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 928 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 929 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 930 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 931 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 932 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 933 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 934 | spec->channel_mode = preset->channel_mode; |
| 935 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 936 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 937 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 938 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 939 | if (preset->const_channel_count) |
| 940 | spec->multiout.max_channels = preset->const_channel_count; |
| 941 | else |
| 942 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 943 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 944 | |
| 945 | spec->multiout.num_dacs = preset->num_dacs; |
| 946 | spec->multiout.dac_nids = preset->dac_nids; |
| 947 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 948 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 949 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 950 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 951 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 952 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 953 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 954 | spec->input_mux = preset->input_mux; |
| 955 | |
| 956 | spec->num_adc_nids = preset->num_adc_nids; |
| 957 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 958 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 959 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 960 | |
| 961 | spec->unsol_event = preset->unsol_event; |
| 962 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 963 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 964 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 965 | spec->loopback.amplist = preset->loopbacks; |
| 966 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 967 | |
| 968 | if (preset->setup) |
| 969 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 970 | |
| 971 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 972 | } |
| 973 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 974 | /* Enable GPIO mask and set output */ |
| 975 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 976 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 977 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 978 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 979 | { } |
| 980 | }; |
| 981 | |
| 982 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 983 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 984 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 985 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 986 | { } |
| 987 | }; |
| 988 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 989 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 990 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 991 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 992 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 993 | { } |
| 994 | }; |
| 995 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 996 | /* |
| 997 | * Fix hardware PLL issue |
| 998 | * On some codecs, the analog PLL gating control must be off while |
| 999 | * the default value is 1. |
| 1000 | */ |
| 1001 | static void alc_fix_pll(struct hda_codec *codec) |
| 1002 | { |
| 1003 | struct alc_spec *spec = codec->spec; |
| 1004 | unsigned int val; |
| 1005 | |
| 1006 | if (!spec->pll_nid) |
| 1007 | return; |
| 1008 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1009 | spec->pll_coef_idx); |
| 1010 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1011 | AC_VERB_GET_PROC_COEF, 0); |
| 1012 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1013 | spec->pll_coef_idx); |
| 1014 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1015 | val & ~(1 << spec->pll_coef_bit)); |
| 1016 | } |
| 1017 | |
| 1018 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1019 | unsigned int coef_idx, unsigned int coef_bit) |
| 1020 | { |
| 1021 | struct alc_spec *spec = codec->spec; |
| 1022 | spec->pll_nid = nid; |
| 1023 | spec->pll_coef_idx = coef_idx; |
| 1024 | spec->pll_coef_bit = coef_bit; |
| 1025 | alc_fix_pll(codec); |
| 1026 | } |
| 1027 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1028 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
| 1029 | static void alc_free_jack_priv(struct snd_jack *jack) |
| 1030 | { |
| 1031 | struct alc_jack *jacks = jack->private_data; |
| 1032 | jacks->nid = 0; |
| 1033 | jacks->jack = NULL; |
| 1034 | } |
| 1035 | |
| 1036 | static int alc_add_jack(struct hda_codec *codec, |
| 1037 | hda_nid_t nid, int type) |
| 1038 | { |
| 1039 | struct alc_spec *spec; |
| 1040 | struct alc_jack *jack; |
| 1041 | const char *name; |
| 1042 | int err; |
| 1043 | |
| 1044 | spec = codec->spec; |
| 1045 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 1046 | jack = snd_array_new(&spec->jacks); |
| 1047 | if (!jack) |
| 1048 | return -ENOMEM; |
| 1049 | |
| 1050 | jack->nid = nid; |
| 1051 | jack->type = type; |
| 1052 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
| 1053 | |
| 1054 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); |
| 1055 | if (err < 0) |
| 1056 | return err; |
| 1057 | jack->jack->private_data = jack; |
| 1058 | jack->jack->private_free = alc_free_jack_priv; |
| 1059 | return 0; |
| 1060 | } |
| 1061 | |
| 1062 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1063 | { |
| 1064 | struct alc_spec *spec = codec->spec; |
| 1065 | struct alc_jack *jacks = spec->jacks.list; |
| 1066 | |
| 1067 | if (jacks) { |
| 1068 | int i; |
| 1069 | for (i = 0; i < spec->jacks.used; i++) { |
| 1070 | if (jacks->nid == nid) { |
| 1071 | unsigned int present; |
| 1072 | present = snd_hda_jack_detect(codec, nid); |
| 1073 | |
| 1074 | present = (present) ? jacks->type : 0; |
| 1075 | |
| 1076 | snd_jack_report(jacks->jack, present); |
| 1077 | } |
| 1078 | jacks++; |
| 1079 | } |
| 1080 | } |
| 1081 | } |
| 1082 | |
| 1083 | static int alc_init_jacks(struct hda_codec *codec) |
| 1084 | { |
| 1085 | struct alc_spec *spec = codec->spec; |
| 1086 | int err; |
| 1087 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1088 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1089 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1090 | if (hp_nid) { |
| 1091 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); |
| 1092 | if (err < 0) |
| 1093 | return err; |
| 1094 | alc_report_jack(codec, hp_nid); |
| 1095 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1096 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1097 | if (mic_nid) { |
| 1098 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); |
| 1099 | if (err < 0) |
| 1100 | return err; |
| 1101 | alc_report_jack(codec, mic_nid); |
| 1102 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1103 | |
| 1104 | return 0; |
| 1105 | } |
| 1106 | #else |
| 1107 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1108 | { |
| 1109 | } |
| 1110 | |
| 1111 | static inline int alc_init_jacks(struct hda_codec *codec) |
| 1112 | { |
| 1113 | return 0; |
| 1114 | } |
| 1115 | #endif |
| 1116 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1117 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1118 | { |
| 1119 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1120 | unsigned int mute; |
| 1121 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1122 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1123 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1124 | spec->jack_present = 0; |
| 1125 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1126 | nid = spec->autocfg.hp_pins[i]; |
| 1127 | if (!nid) |
| 1128 | break; |
| 1129 | if (snd_hda_jack_detect(codec, nid)) { |
| 1130 | spec->jack_present = 1; |
| 1131 | break; |
| 1132 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1133 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1134 | } |
| 1135 | |
| 1136 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1137 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1138 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1139 | nid = spec->autocfg.speaker_pins[i]; |
| 1140 | if (!nid) |
| 1141 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1142 | if (pinctl) { |
| 1143 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1144 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1145 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1146 | } else { |
| 1147 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1148 | HDA_AMP_MUTE, mute); |
| 1149 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1150 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1151 | } |
| 1152 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1153 | static void alc_automute_pin(struct hda_codec *codec) |
| 1154 | { |
| 1155 | alc_automute_speaker(codec, 1); |
| 1156 | } |
| 1157 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1158 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1159 | hda_nid_t nid) |
| 1160 | { |
| 1161 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1162 | int i, nums; |
| 1163 | |
| 1164 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1165 | for (i = 0; i < nums; i++) |
| 1166 | if (conn[i] == nid) |
| 1167 | return i; |
| 1168 | return -1; |
| 1169 | } |
| 1170 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1171 | /* switch the current ADC according to the jack state */ |
| 1172 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1173 | { |
| 1174 | struct alc_spec *spec = codec->spec; |
| 1175 | unsigned int present; |
| 1176 | hda_nid_t new_adc; |
| 1177 | |
| 1178 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1179 | if (present) |
| 1180 | spec->cur_adc_idx = 1; |
| 1181 | else |
| 1182 | spec->cur_adc_idx = 0; |
| 1183 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1184 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1185 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1186 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1187 | spec->cur_adc = new_adc; |
| 1188 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1189 | spec->cur_adc_stream_tag, 0, |
| 1190 | spec->cur_adc_format); |
| 1191 | } |
| 1192 | } |
| 1193 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1194 | static void alc_mic_automute(struct hda_codec *codec) |
| 1195 | { |
| 1196 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1197 | struct alc_mic_route *dead, *alive; |
| 1198 | unsigned int present, type; |
| 1199 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1200 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1201 | if (!spec->auto_mic) |
| 1202 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1203 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1204 | return; |
| 1205 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1206 | return; |
| 1207 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1208 | if (spec->dual_adc_switch) { |
| 1209 | alc_dual_mic_adc_auto_switch(codec); |
| 1210 | return; |
| 1211 | } |
| 1212 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1213 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1214 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1215 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1216 | if (present) { |
| 1217 | alive = &spec->ext_mic; |
| 1218 | dead = &spec->int_mic; |
| 1219 | } else { |
| 1220 | alive = &spec->int_mic; |
| 1221 | dead = &spec->ext_mic; |
| 1222 | } |
| 1223 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1224 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1225 | if (type == AC_WID_AUD_MIX) { |
| 1226 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1227 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1228 | alive->mux_idx, |
| 1229 | HDA_AMP_MUTE, 0); |
| 1230 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1231 | dead->mux_idx, |
| 1232 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1233 | } else { |
| 1234 | /* MUX style (e.g. ALC880) */ |
| 1235 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1236 | AC_VERB_SET_CONNECT_SEL, |
| 1237 | alive->mux_idx); |
| 1238 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1239 | alc_report_jack(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1240 | |
| 1241 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1242 | } |
| 1243 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1244 | /* unsolicited event for HP jack sensing */ |
| 1245 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1246 | { |
| 1247 | if (codec->vendor_id == 0x10ec0880) |
| 1248 | res >>= 28; |
| 1249 | else |
| 1250 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1251 | switch (res) { |
| 1252 | case ALC880_HP_EVENT: |
| 1253 | alc_automute_pin(codec); |
| 1254 | break; |
| 1255 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1256 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1257 | break; |
| 1258 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1259 | } |
| 1260 | |
| 1261 | static void alc_inithook(struct hda_codec *codec) |
| 1262 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1263 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1264 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1265 | } |
| 1266 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1267 | /* additional initialization for ALC888 variants */ |
| 1268 | static void alc888_coef_init(struct hda_codec *codec) |
| 1269 | { |
| 1270 | unsigned int tmp; |
| 1271 | |
| 1272 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1273 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1274 | 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] | 1275 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1276 | /* alc888S-VC */ |
| 1277 | snd_hda_codec_read(codec, 0x20, 0, |
| 1278 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1279 | else |
| 1280 | /* alc888-VB */ |
| 1281 | snd_hda_codec_read(codec, 0x20, 0, |
| 1282 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1283 | } |
| 1284 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1285 | static void alc889_coef_init(struct hda_codec *codec) |
| 1286 | { |
| 1287 | unsigned int tmp; |
| 1288 | |
| 1289 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1290 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1291 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1292 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1293 | } |
| 1294 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1295 | /* turn on/off EAPD control (only if available) */ |
| 1296 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1297 | { |
| 1298 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1299 | return; |
| 1300 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1301 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1302 | on ? 2 : 0); |
| 1303 | } |
| 1304 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1305 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1306 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1307 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1308 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1309 | switch (type) { |
| 1310 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1311 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1312 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1313 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1314 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1315 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1316 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1317 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1318 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1319 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1320 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1321 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1322 | set_eapd(codec, 0x0f, 1); |
| 1323 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1324 | break; |
| 1325 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1326 | case 0x10ec0267: |
| 1327 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1328 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1329 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1330 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1331 | case 0x10ec0660: |
| 1332 | case 0x10ec0662: |
| 1333 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1334 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1335 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1336 | set_eapd(codec, 0x14, 1); |
| 1337 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1338 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1339 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1340 | switch (codec->vendor_id) { |
| 1341 | case 0x10ec0260: |
| 1342 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1343 | AC_VERB_SET_COEF_INDEX, 7); |
| 1344 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1345 | AC_VERB_GET_PROC_COEF, 0); |
| 1346 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1347 | AC_VERB_SET_COEF_INDEX, 7); |
| 1348 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1349 | AC_VERB_SET_PROC_COEF, |
| 1350 | tmp | 0x2010); |
| 1351 | break; |
| 1352 | case 0x10ec0262: |
| 1353 | case 0x10ec0880: |
| 1354 | case 0x10ec0882: |
| 1355 | case 0x10ec0883: |
| 1356 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1357 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1358 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1359 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1360 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1361 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1362 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1363 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1364 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1365 | case 0x10ec0267: |
| 1366 | case 0x10ec0268: |
| 1367 | snd_hda_codec_write(codec, 0x20, 0, |
| 1368 | AC_VERB_SET_COEF_INDEX, 7); |
| 1369 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1370 | AC_VERB_GET_PROC_COEF, 0); |
| 1371 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1372 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1373 | snd_hda_codec_write(codec, 0x20, 0, |
| 1374 | AC_VERB_SET_PROC_COEF, |
| 1375 | tmp | 0x3000); |
| 1376 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1377 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1378 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1379 | break; |
| 1380 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1381 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1382 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1383 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1384 | { |
| 1385 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1386 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1387 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1388 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1389 | if (!cfg->hp_pins[0]) { |
| 1390 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1391 | return; |
| 1392 | } |
| 1393 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1394 | if (!cfg->speaker_pins[0]) { |
| 1395 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1396 | return; |
| 1397 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1398 | sizeof(cfg->speaker_pins)); |
| 1399 | cfg->speaker_outs = cfg->line_outs; |
| 1400 | } |
| 1401 | |
| 1402 | if (!cfg->hp_pins[0]) { |
| 1403 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1404 | sizeof(cfg->hp_pins)); |
| 1405 | cfg->hp_outs = cfg->line_outs; |
| 1406 | } |
| 1407 | |
| 1408 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1409 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1410 | cfg->hp_pins[i]); |
| 1411 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1412 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1413 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1414 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1415 | spec->unsol_event = alc_sku_unsol_event; |
| 1416 | } |
| 1417 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1418 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1419 | { |
| 1420 | struct alc_spec *spec = codec->spec; |
| 1421 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1422 | hda_nid_t fixed, ext; |
| 1423 | int i; |
| 1424 | |
| 1425 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1426 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1427 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1428 | return; |
| 1429 | |
| 1430 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1431 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1432 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1433 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1434 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1435 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1436 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1437 | if (fixed) |
| 1438 | return; /* already occupied */ |
| 1439 | fixed = nid; |
| 1440 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1441 | case INPUT_PIN_ATTR_UNUSED: |
| 1442 | return; /* invalid entry */ |
| 1443 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1444 | if (ext) |
| 1445 | return; /* already occupied */ |
| 1446 | ext = nid; |
| 1447 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1448 | } |
| 1449 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1450 | if (!ext || !fixed) |
| 1451 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1452 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1453 | return; /* no unsol support */ |
| 1454 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1455 | ext, fixed); |
| 1456 | spec->ext_mic.pin = ext; |
| 1457 | spec->int_mic.pin = fixed; |
| 1458 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1459 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1460 | spec->auto_mic = 1; |
| 1461 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1462 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1463 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1464 | spec->unsol_event = alc_sku_unsol_event; |
| 1465 | } |
| 1466 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1467 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1468 | * the driver to ignore any present sku defines. |
| 1469 | */ |
| 1470 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1471 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1472 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1473 | { |
| 1474 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1475 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1476 | struct alc_spec *spec = codec->spec; |
| 1477 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1478 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1479 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1480 | if (spec->cdefine.fixup) { |
| 1481 | ass = spec->cdefine.sku_cfg; |
| 1482 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1483 | return -1; |
| 1484 | goto do_sku; |
| 1485 | } |
| 1486 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1487 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1488 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1489 | goto do_sku; |
| 1490 | |
| 1491 | nid = 0x1d; |
| 1492 | if (codec->vendor_id == 0x10ec0260) |
| 1493 | nid = 0x17; |
| 1494 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1495 | |
| 1496 | if (!(ass & 1)) { |
| 1497 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1498 | codec->chip_name, ass); |
| 1499 | return -1; |
| 1500 | } |
| 1501 | |
| 1502 | /* check sum */ |
| 1503 | tmp = 0; |
| 1504 | for (i = 1; i < 16; i++) { |
| 1505 | if ((ass >> i) & 1) |
| 1506 | tmp++; |
| 1507 | } |
| 1508 | if (((ass >> 16) & 0xf) != tmp) |
| 1509 | return -1; |
| 1510 | |
| 1511 | spec->cdefine.port_connectivity = ass >> 30; |
| 1512 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1513 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1514 | spec->cdefine.customization = ass >> 8; |
| 1515 | do_sku: |
| 1516 | spec->cdefine.sku_cfg = ass; |
| 1517 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1518 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1519 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1520 | spec->cdefine.override = ass & 0x1; |
| 1521 | |
| 1522 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1523 | nid, spec->cdefine.sku_cfg); |
| 1524 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1525 | spec->cdefine.port_connectivity); |
| 1526 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1527 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1528 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1529 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1530 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1531 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1532 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1533 | |
| 1534 | return 0; |
| 1535 | } |
| 1536 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1537 | /* check subsystem ID and set up device-specific initialization; |
| 1538 | * return 1 if initialized, 0 if invalid SSID |
| 1539 | */ |
| 1540 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1541 | * 31 ~ 16 : Manufacture ID |
| 1542 | * 15 ~ 8 : SKU ID |
| 1543 | * 7 ~ 0 : Assembly ID |
| 1544 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1545 | */ |
| 1546 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1547 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1548 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1549 | { |
| 1550 | unsigned int ass, tmp, i; |
| 1551 | unsigned nid; |
| 1552 | struct alc_spec *spec = codec->spec; |
| 1553 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1554 | if (spec->cdefine.fixup) { |
| 1555 | ass = spec->cdefine.sku_cfg; |
| 1556 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1557 | return 0; |
| 1558 | goto do_sku; |
| 1559 | } |
| 1560 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1561 | ass = codec->subsystem_id & 0xffff; |
| 1562 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1563 | goto do_sku; |
| 1564 | |
| 1565 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1566 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1567 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1568 | * 29~21 : reserve |
| 1569 | * 20 : PCBEEP input |
| 1570 | * 19~16 : Check sum (15:1) |
| 1571 | * 15~1 : Custom |
| 1572 | * 0 : override |
| 1573 | */ |
| 1574 | nid = 0x1d; |
| 1575 | if (codec->vendor_id == 0x10ec0260) |
| 1576 | nid = 0x17; |
| 1577 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1578 | snd_printd("realtek: No valid SSID, " |
| 1579 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1580 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1581 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1582 | return 0; |
| 1583 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1584 | return 0; |
| 1585 | |
| 1586 | /* check sum */ |
| 1587 | tmp = 0; |
| 1588 | for (i = 1; i < 16; i++) { |
| 1589 | if ((ass >> i) & 1) |
| 1590 | tmp++; |
| 1591 | } |
| 1592 | if (((ass >> 16) & 0xf) != tmp) |
| 1593 | return 0; |
| 1594 | do_sku: |
| 1595 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1596 | ass & 0xffff, codec->vendor_id); |
| 1597 | /* |
| 1598 | * 0 : override |
| 1599 | * 1 : Swap Jack |
| 1600 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1601 | * 3~5 : External Amplifier control |
| 1602 | * 7~6 : Reserved |
| 1603 | */ |
| 1604 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1605 | switch (tmp) { |
| 1606 | case 1: |
| 1607 | spec->init_amp = ALC_INIT_GPIO1; |
| 1608 | break; |
| 1609 | case 3: |
| 1610 | spec->init_amp = ALC_INIT_GPIO2; |
| 1611 | break; |
| 1612 | case 7: |
| 1613 | spec->init_amp = ALC_INIT_GPIO3; |
| 1614 | break; |
| 1615 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1616 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1617 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1618 | break; |
| 1619 | } |
| 1620 | |
| 1621 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1622 | * when the external headphone out jack is plugged" |
| 1623 | */ |
| 1624 | if (!(ass & 0x8000)) |
| 1625 | return 1; |
| 1626 | /* |
| 1627 | * 10~8 : Jack location |
| 1628 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1629 | * 14~13: Resvered |
| 1630 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1631 | * when the external headphone out jack is plugged" |
| 1632 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1633 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1634 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1635 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1636 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1637 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1638 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1639 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1640 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1641 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1642 | else if (tmp == 3) |
| 1643 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1644 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1645 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1646 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1647 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1648 | return 1; |
| 1649 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1650 | } |
| 1651 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1652 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1653 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1654 | return 1; |
| 1655 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1656 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1657 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1658 | hda_nid_t porta, hda_nid_t porte, |
| 1659 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1660 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1661 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1662 | struct alc_spec *spec = codec->spec; |
| 1663 | snd_printd("realtek: " |
| 1664 | "Enable default setup for auto mode as fallback\n"); |
| 1665 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1666 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1667 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1668 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1669 | } |
| 1670 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1671 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1672 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1673 | */ |
| 1674 | |
| 1675 | struct alc_pincfg { |
| 1676 | hda_nid_t nid; |
| 1677 | u32 val; |
| 1678 | }; |
| 1679 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame^] | 1680 | struct alc_model_fixup { |
| 1681 | const int id; |
| 1682 | const char *name; |
| 1683 | }; |
| 1684 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1685 | struct alc_fixup { |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1686 | unsigned int sku; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1687 | const struct alc_pincfg *pins; |
| 1688 | const struct hda_verb *verbs; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1689 | void (*func)(struct hda_codec *codec, const struct alc_fixup *fix, |
| 1690 | int pre_init); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1691 | }; |
| 1692 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame^] | 1693 | static void __alc_pick_fixup(struct hda_codec *codec, |
| 1694 | const struct alc_fixup *fix, |
| 1695 | const char *modelname, |
| 1696 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1697 | { |
| 1698 | const struct alc_pincfg *cfg; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1699 | struct alc_spec *spec; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1700 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1701 | cfg = fix->pins; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1702 | if (pre_init && fix->sku) { |
| 1703 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1704 | snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame^] | 1705 | codec->chip_name, modelname); |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1706 | #endif |
| 1707 | spec = codec->spec; |
| 1708 | spec->cdefine.sku_cfg = fix->sku; |
| 1709 | spec->cdefine.fixup = 1; |
| 1710 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1711 | if (pre_init && cfg) { |
| 1712 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1713 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame^] | 1714 | codec->chip_name, modelname); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1715 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1716 | for (; cfg->nid; cfg++) |
| 1717 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1718 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1719 | if (!pre_init && fix->verbs) { |
| 1720 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1721 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame^] | 1722 | codec->chip_name, modelname); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1723 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1724 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1725 | } |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1726 | if (fix->func) { |
| 1727 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1728 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n", |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame^] | 1729 | codec->chip_name, modelname); |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1730 | #endif |
| 1731 | fix->func(codec, fix, pre_init); |
| 1732 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1733 | } |
| 1734 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame^] | 1735 | static void alc_pick_fixup(struct hda_codec *codec, |
| 1736 | const struct snd_pci_quirk *quirk, |
| 1737 | const struct alc_fixup *fix, |
| 1738 | int pre_init) |
| 1739 | { |
| 1740 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1741 | if (quirk) { |
| 1742 | fix += quirk->value; |
| 1743 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1744 | __alc_pick_fixup(codec, fix, quirk->name, pre_init); |
| 1745 | #else |
| 1746 | __alc_pick_fixup(codec, fix, NULL, pre_init); |
| 1747 | #endif |
| 1748 | } |
| 1749 | } |
| 1750 | |
| 1751 | static void alc_pick_fixup_model(struct hda_codec *codec, |
| 1752 | const struct alc_model_fixup *models, |
| 1753 | const struct snd_pci_quirk *quirk, |
| 1754 | const struct alc_fixup *fix, |
| 1755 | int pre_init) |
| 1756 | { |
| 1757 | if (codec->modelname && models) { |
| 1758 | while (models->name) { |
| 1759 | if (!strcmp(codec->modelname, models->name)) { |
| 1760 | fix += models->id; |
| 1761 | break; |
| 1762 | } |
| 1763 | models++; |
| 1764 | } |
| 1765 | __alc_pick_fixup(codec, fix, codec->modelname, pre_init); |
| 1766 | } else { |
| 1767 | alc_pick_fixup(codec, quirk, fix, pre_init); |
| 1768 | } |
| 1769 | } |
| 1770 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1771 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1772 | unsigned int coef_idx) |
| 1773 | { |
| 1774 | unsigned int val; |
| 1775 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1776 | coef_idx); |
| 1777 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1778 | AC_VERB_GET_PROC_COEF, 0); |
| 1779 | return val; |
| 1780 | } |
| 1781 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1782 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1783 | unsigned int coef_val) |
| 1784 | { |
| 1785 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1786 | coef_idx); |
| 1787 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1788 | coef_val); |
| 1789 | } |
| 1790 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1791 | /* set right pin controls for digital I/O */ |
| 1792 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1793 | { |
| 1794 | struct alc_spec *spec = codec->spec; |
| 1795 | int i; |
| 1796 | hda_nid_t pin; |
| 1797 | |
| 1798 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1799 | pin = spec->autocfg.dig_out_pins[i]; |
| 1800 | if (pin) { |
| 1801 | snd_hda_codec_write(codec, pin, 0, |
| 1802 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1803 | PIN_OUT); |
| 1804 | } |
| 1805 | } |
| 1806 | pin = spec->autocfg.dig_in_pin; |
| 1807 | if (pin) |
| 1808 | snd_hda_codec_write(codec, pin, 0, |
| 1809 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1810 | PIN_IN); |
| 1811 | } |
| 1812 | |
| 1813 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1814 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1815 | { |
| 1816 | struct alc_spec *spec = codec->spec; |
| 1817 | int i, err; |
| 1818 | hda_nid_t dig_nid; |
| 1819 | |
| 1820 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1821 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1822 | err = snd_hda_get_connections(codec, |
| 1823 | spec->autocfg.dig_out_pins[i], |
| 1824 | &dig_nid, 1); |
| 1825 | if (err < 0) |
| 1826 | continue; |
| 1827 | if (!i) { |
| 1828 | spec->multiout.dig_out_nid = dig_nid; |
| 1829 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1830 | } else { |
| 1831 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1832 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1833 | break; |
| 1834 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1835 | } |
| 1836 | } |
| 1837 | |
| 1838 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1839 | dig_nid = codec->start_nid; |
| 1840 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1841 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1842 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1843 | continue; |
| 1844 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1845 | continue; |
| 1846 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1847 | continue; |
| 1848 | err = get_connection_index(codec, dig_nid, |
| 1849 | spec->autocfg.dig_in_pin); |
| 1850 | if (err >= 0) { |
| 1851 | spec->dig_in_nid = dig_nid; |
| 1852 | break; |
| 1853 | } |
| 1854 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1855 | } |
| 1856 | } |
| 1857 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1858 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1859 | * ALC888 |
| 1860 | */ |
| 1861 | |
| 1862 | /* |
| 1863 | * 2ch mode |
| 1864 | */ |
| 1865 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1866 | /* Mic-in jack as mic in */ |
| 1867 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1868 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1869 | /* Line-in jack as Line in */ |
| 1870 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1871 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1872 | /* Line-Out as Front */ |
| 1873 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1874 | { } /* end */ |
| 1875 | }; |
| 1876 | |
| 1877 | /* |
| 1878 | * 4ch mode |
| 1879 | */ |
| 1880 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1881 | /* Mic-in jack as mic in */ |
| 1882 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1883 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1884 | /* Line-in jack as Surround */ |
| 1885 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1886 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1887 | /* Line-Out as Front */ |
| 1888 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1889 | { } /* end */ |
| 1890 | }; |
| 1891 | |
| 1892 | /* |
| 1893 | * 6ch mode |
| 1894 | */ |
| 1895 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1896 | /* Mic-in jack as CLFE */ |
| 1897 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1898 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1899 | /* Line-in jack as Surround */ |
| 1900 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1901 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1902 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1903 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1904 | { } /* end */ |
| 1905 | }; |
| 1906 | |
| 1907 | /* |
| 1908 | * 8ch mode |
| 1909 | */ |
| 1910 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1911 | /* Mic-in jack as CLFE */ |
| 1912 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1913 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1914 | /* Line-in jack as Surround */ |
| 1915 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1916 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1917 | /* Line-Out as Side */ |
| 1918 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1919 | { } /* end */ |
| 1920 | }; |
| 1921 | |
| 1922 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1923 | { 2, alc888_4ST_ch2_intel_init }, |
| 1924 | { 4, alc888_4ST_ch4_intel_init }, |
| 1925 | { 6, alc888_4ST_ch6_intel_init }, |
| 1926 | { 8, alc888_4ST_ch8_intel_init }, |
| 1927 | }; |
| 1928 | |
| 1929 | /* |
| 1930 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1931 | */ |
| 1932 | |
| 1933 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1934 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1935 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1936 | /* Connect Internal HP to Front */ |
| 1937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1939 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1940 | /* Connect Bass HP to Front */ |
| 1941 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1942 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1943 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1944 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1945 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1946 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1947 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1948 | /* Connect Mic jack to CLFE */ |
| 1949 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1950 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1951 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1952 | /* Connect Line-in jack to Surround */ |
| 1953 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1954 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1955 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1956 | /* Connect HP out jack to Front */ |
| 1957 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1958 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1959 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1960 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1961 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1962 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1963 | {} |
| 1964 | }; |
| 1965 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1966 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1967 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1968 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1969 | } |
| 1970 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1971 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1972 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1973 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1974 | if (codec->vendor_id == 0x10ec0880) |
| 1975 | res >>= 28; |
| 1976 | else |
| 1977 | res >>= 26; |
| 1978 | if (res == ALC880_HP_EVENT) |
| 1979 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1980 | } |
| 1981 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1982 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1983 | { |
| 1984 | struct alc_spec *spec = codec->spec; |
| 1985 | |
| 1986 | spec->autocfg.hp_pins[0] = 0x15; |
| 1987 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1988 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1989 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1990 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1991 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1992 | } |
| 1993 | |
| 1994 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1995 | { |
| 1996 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1997 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1998 | } |
| 1999 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2000 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2001 | { |
| 2002 | struct alc_spec *spec = codec->spec; |
| 2003 | |
| 2004 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2005 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2006 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2007 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2008 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2009 | |
| 2010 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2011 | * ALC888 Acer Aspire 4930G model |
| 2012 | */ |
| 2013 | |
| 2014 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 2015 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2016 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2017 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2018 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2019 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2020 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2021 | /* Connect Internal HP to front */ |
| 2022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2023 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2024 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2025 | /* Connect HP out to front */ |
| 2026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2028 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2029 | { } |
| 2030 | }; |
| 2031 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2032 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2033 | * ALC888 Acer Aspire 6530G model |
| 2034 | */ |
| 2035 | |
| 2036 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2037 | /* Route to built-in subwoofer as well as speakers */ |
| 2038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2040 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2041 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2042 | /* Bias voltage on for external mic port */ |
| 2043 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2044 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2045 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2046 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2048 | /* Enable unsolicited event for HP jack */ |
| 2049 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2050 | /* Enable speaker output */ |
| 2051 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2052 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2053 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2054 | /* Enable headphone output */ |
| 2055 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2056 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2057 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2058 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2059 | { } |
| 2060 | }; |
| 2061 | |
| 2062 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2063 | *ALC888 Acer Aspire 7730G model |
| 2064 | */ |
| 2065 | |
| 2066 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2067 | /* Bias voltage on for external mic port */ |
| 2068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2069 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2070 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2071 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2072 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2073 | /* Enable unsolicited event for HP jack */ |
| 2074 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2075 | /* Enable speaker output */ |
| 2076 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2077 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2078 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2079 | /* Enable headphone output */ |
| 2080 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2081 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2083 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2084 | /*Enable internal subwoofer */ |
| 2085 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2086 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2087 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2088 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2089 | { } |
| 2090 | }; |
| 2091 | |
| 2092 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2093 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2094 | */ |
| 2095 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2096 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2097 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2098 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2099 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2101 | /* Enable unsolicited event for HP jack */ |
| 2102 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2103 | /* Connect Internal Front to Front */ |
| 2104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2106 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2107 | /* Connect Internal Rear to Rear */ |
| 2108 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2109 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2110 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2111 | /* Connect Internal CLFE to CLFE */ |
| 2112 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2113 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2114 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2115 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2116 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2117 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2118 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2119 | /* Enable all DACs */ |
| 2120 | /* DAC DISABLE/MUTE 1? */ |
| 2121 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2122 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2123 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2124 | /* DAC DISABLE/MUTE 2? */ |
| 2125 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2126 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2127 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2128 | /* DMIC fix |
| 2129 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2130 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2131 | * makes the signal become a difference/sum signal instead of standard |
| 2132 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2133 | * codec replicate the sum signal to both channels, turning it into a |
| 2134 | * normal mono mic. |
| 2135 | */ |
| 2136 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2137 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2138 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2139 | { } |
| 2140 | }; |
| 2141 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2142 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2143 | /* Front mic only available on one ADC */ |
| 2144 | { |
| 2145 | .num_items = 4, |
| 2146 | .items = { |
| 2147 | { "Mic", 0x0 }, |
| 2148 | { "Line", 0x2 }, |
| 2149 | { "CD", 0x4 }, |
| 2150 | { "Front Mic", 0xb }, |
| 2151 | }, |
| 2152 | }, |
| 2153 | { |
| 2154 | .num_items = 3, |
| 2155 | .items = { |
| 2156 | { "Mic", 0x0 }, |
| 2157 | { "Line", 0x2 }, |
| 2158 | { "CD", 0x4 }, |
| 2159 | }, |
| 2160 | } |
| 2161 | }; |
| 2162 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2163 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2164 | /* Interal mic only available on one ADC */ |
| 2165 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2166 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2167 | .items = { |
| 2168 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2169 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2170 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2171 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2172 | { "Int Mic", 0xb }, |
| 2173 | }, |
| 2174 | }, |
| 2175 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2176 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2177 | .items = { |
| 2178 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2179 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2180 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2181 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2182 | }, |
| 2183 | } |
| 2184 | }; |
| 2185 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2186 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2187 | /* Digital mic only available on first "ADC" */ |
| 2188 | { |
| 2189 | .num_items = 5, |
| 2190 | .items = { |
| 2191 | { "Mic", 0x0 }, |
| 2192 | { "Line", 0x2 }, |
| 2193 | { "CD", 0x4 }, |
| 2194 | { "Front Mic", 0xb }, |
| 2195 | { "Input Mix", 0xa }, |
| 2196 | }, |
| 2197 | }, |
| 2198 | { |
| 2199 | .num_items = 4, |
| 2200 | .items = { |
| 2201 | { "Mic", 0x0 }, |
| 2202 | { "Line", 0x2 }, |
| 2203 | { "CD", 0x4 }, |
| 2204 | { "Input Mix", 0xa }, |
| 2205 | }, |
| 2206 | }, |
| 2207 | { |
| 2208 | .num_items = 4, |
| 2209 | .items = { |
| 2210 | { "Mic", 0x0 }, |
| 2211 | { "Line", 0x2 }, |
| 2212 | { "CD", 0x4 }, |
| 2213 | { "Input Mix", 0xa }, |
| 2214 | }, |
| 2215 | } |
| 2216 | }; |
| 2217 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2218 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2219 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2220 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2221 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2222 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2223 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2224 | HDA_OUTPUT), |
| 2225 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2226 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2227 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2228 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2229 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2230 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2231 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2232 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2233 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2235 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 2236 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2237 | { } /* end */ |
| 2238 | }; |
| 2239 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2240 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2241 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2242 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2243 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2244 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2245 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2246 | HDA_OUTPUT), |
| 2247 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2248 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2249 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2250 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2251 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2252 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2253 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 2254 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2255 | { } /* end */ |
| 2256 | }; |
| 2257 | |
| 2258 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2259 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2260 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2261 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2262 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2263 | spec->autocfg.hp_pins[0] = 0x15; |
| 2264 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2265 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2266 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2267 | } |
| 2268 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2269 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2270 | { |
| 2271 | struct alc_spec *spec = codec->spec; |
| 2272 | |
| 2273 | spec->autocfg.hp_pins[0] = 0x15; |
| 2274 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2275 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2276 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2277 | } |
| 2278 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2279 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2280 | { |
| 2281 | struct alc_spec *spec = codec->spec; |
| 2282 | |
| 2283 | spec->autocfg.hp_pins[0] = 0x15; |
| 2284 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2285 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2286 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2287 | } |
| 2288 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2289 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2290 | { |
| 2291 | struct alc_spec *spec = codec->spec; |
| 2292 | |
| 2293 | spec->autocfg.hp_pins[0] = 0x15; |
| 2294 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2295 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2296 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2297 | } |
| 2298 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2299 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2300 | * ALC880 3-stack model |
| 2301 | * |
| 2302 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2303 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2304 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2305 | */ |
| 2306 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2307 | static hda_nid_t alc880_dac_nids[4] = { |
| 2308 | /* front, rear, clfe, rear_surr */ |
| 2309 | 0x02, 0x05, 0x04, 0x03 |
| 2310 | }; |
| 2311 | |
| 2312 | static hda_nid_t alc880_adc_nids[3] = { |
| 2313 | /* ADC0-2 */ |
| 2314 | 0x07, 0x08, 0x09, |
| 2315 | }; |
| 2316 | |
| 2317 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2318 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2319 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2320 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2321 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2322 | /* ADC1-2 */ |
| 2323 | 0x08, 0x09, |
| 2324 | }; |
| 2325 | |
| 2326 | #define ALC880_DIGOUT_NID 0x06 |
| 2327 | #define ALC880_DIGIN_NID 0x0a |
| 2328 | |
| 2329 | static struct hda_input_mux alc880_capture_source = { |
| 2330 | .num_items = 4, |
| 2331 | .items = { |
| 2332 | { "Mic", 0x0 }, |
| 2333 | { "Front Mic", 0x3 }, |
| 2334 | { "Line", 0x2 }, |
| 2335 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2336 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2337 | }; |
| 2338 | |
| 2339 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2340 | /* 2ch mode */ |
| 2341 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2342 | /* set line-in to input, mute it */ |
| 2343 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2344 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2345 | /* set mic-in to input vref 80%, mute it */ |
| 2346 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2347 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2348 | { } /* end */ |
| 2349 | }; |
| 2350 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2351 | /* 6ch mode */ |
| 2352 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2353 | /* set line-in to output, unmute it */ |
| 2354 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2355 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2356 | /* set mic-in to output, unmute it */ |
| 2357 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2358 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2359 | { } /* end */ |
| 2360 | }; |
| 2361 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2362 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2363 | { 2, alc880_threestack_ch2_init }, |
| 2364 | { 6, alc880_threestack_ch6_init }, |
| 2365 | }; |
| 2366 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2367 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2368 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2369 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2370 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2371 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2372 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2373 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2374 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2375 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2376 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2377 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2378 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2379 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2380 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2381 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2382 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2383 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2384 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2385 | { |
| 2386 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2387 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2388 | .info = alc_ch_mode_info, |
| 2389 | .get = alc_ch_mode_get, |
| 2390 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2391 | }, |
| 2392 | { } /* end */ |
| 2393 | }; |
| 2394 | |
| 2395 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2396 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2397 | struct snd_ctl_elem_info *uinfo) |
| 2398 | { |
| 2399 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2400 | struct alc_spec *spec = codec->spec; |
| 2401 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2402 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2403 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2404 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2405 | HDA_INPUT); |
| 2406 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2407 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2408 | return err; |
| 2409 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2410 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2411 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2412 | unsigned int size, unsigned int __user *tlv) |
| 2413 | { |
| 2414 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2415 | struct alc_spec *spec = codec->spec; |
| 2416 | int err; |
| 2417 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2418 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2419 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2420 | HDA_INPUT); |
| 2421 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2422 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2423 | return err; |
| 2424 | } |
| 2425 | |
| 2426 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2427 | struct snd_ctl_elem_value *ucontrol); |
| 2428 | |
| 2429 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2430 | struct snd_ctl_elem_value *ucontrol, |
| 2431 | getput_call_t func) |
| 2432 | { |
| 2433 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2434 | struct alc_spec *spec = codec->spec; |
| 2435 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2436 | int err; |
| 2437 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2438 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2439 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2440 | 3, 0, HDA_INPUT); |
| 2441 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2442 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2443 | return err; |
| 2444 | } |
| 2445 | |
| 2446 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2447 | struct snd_ctl_elem_value *ucontrol) |
| 2448 | { |
| 2449 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2450 | snd_hda_mixer_amp_volume_get); |
| 2451 | } |
| 2452 | |
| 2453 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2454 | struct snd_ctl_elem_value *ucontrol) |
| 2455 | { |
| 2456 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2457 | snd_hda_mixer_amp_volume_put); |
| 2458 | } |
| 2459 | |
| 2460 | /* capture mixer elements */ |
| 2461 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2462 | |
| 2463 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2464 | struct snd_ctl_elem_value *ucontrol) |
| 2465 | { |
| 2466 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2467 | snd_hda_mixer_amp_switch_get); |
| 2468 | } |
| 2469 | |
| 2470 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2471 | struct snd_ctl_elem_value *ucontrol) |
| 2472 | { |
| 2473 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2474 | snd_hda_mixer_amp_switch_put); |
| 2475 | } |
| 2476 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2477 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2478 | { \ |
| 2479 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2480 | .name = "Capture Switch", \ |
| 2481 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2482 | .count = num, \ |
| 2483 | .info = alc_cap_sw_info, \ |
| 2484 | .get = alc_cap_sw_get, \ |
| 2485 | .put = alc_cap_sw_put, \ |
| 2486 | }, \ |
| 2487 | { \ |
| 2488 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2489 | .name = "Capture Volume", \ |
| 2490 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2491 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2492 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2493 | .count = num, \ |
| 2494 | .info = alc_cap_vol_info, \ |
| 2495 | .get = alc_cap_vol_get, \ |
| 2496 | .put = alc_cap_vol_put, \ |
| 2497 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2498 | } |
| 2499 | |
| 2500 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2501 | { \ |
| 2502 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2503 | /* .name = "Capture Source", */ \ |
| 2504 | .name = "Input Source", \ |
| 2505 | .count = num, \ |
| 2506 | .info = alc_mux_enum_info, \ |
| 2507 | .get = alc_mux_enum_get, \ |
| 2508 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2509 | } |
| 2510 | |
| 2511 | #define DEFINE_CAPMIX(num) \ |
| 2512 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2513 | _DEFINE_CAPMIX(num), \ |
| 2514 | _DEFINE_CAPSRC(num), \ |
| 2515 | { } /* end */ \ |
| 2516 | } |
| 2517 | |
| 2518 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2519 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2520 | _DEFINE_CAPMIX(num), \ |
| 2521 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2522 | } |
| 2523 | |
| 2524 | /* up to three ADCs */ |
| 2525 | DEFINE_CAPMIX(1); |
| 2526 | DEFINE_CAPMIX(2); |
| 2527 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2528 | DEFINE_CAPMIX_NOSRC(1); |
| 2529 | DEFINE_CAPMIX_NOSRC(2); |
| 2530 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2531 | |
| 2532 | /* |
| 2533 | * ALC880 5-stack model |
| 2534 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2535 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2536 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2537 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2538 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2539 | */ |
| 2540 | |
| 2541 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2542 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2543 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2544 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2545 | { } /* end */ |
| 2546 | }; |
| 2547 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2548 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2549 | /* 6ch mode */ |
| 2550 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2551 | /* set line-in to input, mute it */ |
| 2552 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2553 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2554 | { } /* end */ |
| 2555 | }; |
| 2556 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2557 | /* 8ch mode */ |
| 2558 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2559 | /* set line-in to output, unmute it */ |
| 2560 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2561 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2562 | { } /* end */ |
| 2563 | }; |
| 2564 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2565 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2566 | { 6, alc880_fivestack_ch6_init }, |
| 2567 | { 8, alc880_fivestack_ch8_init }, |
| 2568 | }; |
| 2569 | |
| 2570 | |
| 2571 | /* |
| 2572 | * ALC880 6-stack model |
| 2573 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2574 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2575 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2576 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2577 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2578 | */ |
| 2579 | |
| 2580 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2581 | /* front, rear, clfe, rear_surr */ |
| 2582 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2583 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2584 | |
| 2585 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2586 | .num_items = 4, |
| 2587 | .items = { |
| 2588 | { "Mic", 0x0 }, |
| 2589 | { "Front Mic", 0x1 }, |
| 2590 | { "Line", 0x2 }, |
| 2591 | { "CD", 0x4 }, |
| 2592 | }, |
| 2593 | }; |
| 2594 | |
| 2595 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2596 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2597 | { 8, NULL }, |
| 2598 | }; |
| 2599 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2600 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2601 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2602 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2603 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2604 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2605 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2606 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2607 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2608 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2609 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2610 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2611 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2612 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2613 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2614 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2615 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2616 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2617 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2618 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2619 | { |
| 2620 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2621 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2622 | .info = alc_ch_mode_info, |
| 2623 | .get = alc_ch_mode_get, |
| 2624 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2625 | }, |
| 2626 | { } /* end */ |
| 2627 | }; |
| 2628 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2629 | |
| 2630 | /* |
| 2631 | * ALC880 W810 model |
| 2632 | * |
| 2633 | * W810 has rear IO for: |
| 2634 | * Front (DAC 02) |
| 2635 | * Surround (DAC 03) |
| 2636 | * Center/LFE (DAC 04) |
| 2637 | * Digital out (06) |
| 2638 | * |
| 2639 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2640 | * 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] | 2641 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2642 | * There is a variable resistor to control the speaker or headphone |
| 2643 | * volume. This is a hardware-only device without a software API. |
| 2644 | * |
| 2645 | * Plugging headphones in will disable the internal speakers. This is |
| 2646 | * implemented in hardware, not via the driver using jack sense. In |
| 2647 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2648 | * disable both the speakers and headphones. |
| 2649 | * |
| 2650 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2651 | * These may not do anything useful with this driver yet, because I |
| 2652 | * haven't setup any initialization verbs for these yet... |
| 2653 | */ |
| 2654 | |
| 2655 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2656 | /* front, rear/surround, clfe */ |
| 2657 | 0x02, 0x03, 0x04 |
| 2658 | }; |
| 2659 | |
| 2660 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2661 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2662 | { 6, NULL } |
| 2663 | }; |
| 2664 | |
| 2665 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2666 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2667 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2668 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2669 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2670 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2671 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2672 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2673 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2674 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2675 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2676 | { } /* end */ |
| 2677 | }; |
| 2678 | |
| 2679 | |
| 2680 | /* |
| 2681 | * Z710V model |
| 2682 | * |
| 2683 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2684 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2685 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2686 | */ |
| 2687 | |
| 2688 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2689 | 0x02 |
| 2690 | }; |
| 2691 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2692 | |
| 2693 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2694 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2695 | { 2, NULL } |
| 2696 | }; |
| 2697 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2698 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2699 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2700 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2701 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2702 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2703 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2704 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2705 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2707 | { } /* end */ |
| 2708 | }; |
| 2709 | |
| 2710 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2711 | /* |
| 2712 | * ALC880 F1734 model |
| 2713 | * |
| 2714 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2715 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2716 | */ |
| 2717 | |
| 2718 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2719 | 0x03 |
| 2720 | }; |
| 2721 | #define ALC880_F1734_HP_DAC 0x02 |
| 2722 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2723 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2724 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2725 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2726 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2727 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2728 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2729 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2730 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2731 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2732 | { } /* end */ |
| 2733 | }; |
| 2734 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2735 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2736 | .num_items = 2, |
| 2737 | .items = { |
| 2738 | { "Mic", 0x1 }, |
| 2739 | { "CD", 0x4 }, |
| 2740 | }, |
| 2741 | }; |
| 2742 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2743 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2744 | /* |
| 2745 | * ALC880 ASUS model |
| 2746 | * |
| 2747 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2748 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2749 | * Mic = 0x18, Line = 0x1a |
| 2750 | */ |
| 2751 | |
| 2752 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2753 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2754 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2755 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2756 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2757 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2758 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2759 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2760 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2761 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2762 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2763 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2764 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2765 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2766 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2767 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2768 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2769 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2770 | { |
| 2771 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2772 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2773 | .info = alc_ch_mode_info, |
| 2774 | .get = alc_ch_mode_get, |
| 2775 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2776 | }, |
| 2777 | { } /* end */ |
| 2778 | }; |
| 2779 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2780 | /* |
| 2781 | * ALC880 ASUS W1V model |
| 2782 | * |
| 2783 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2784 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2785 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2786 | */ |
| 2787 | |
| 2788 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2789 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2790 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2791 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2792 | { } /* end */ |
| 2793 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2794 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2795 | /* TCL S700 */ |
| 2796 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2797 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2798 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2799 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2801 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2802 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2804 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2805 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2806 | { } /* end */ |
| 2807 | }; |
| 2808 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2809 | /* Uniwill */ |
| 2810 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2811 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2812 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2813 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2814 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2815 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2816 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2817 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2818 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2819 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2820 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2821 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2822 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2823 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2824 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2825 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2826 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2827 | { |
| 2828 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2829 | .name = "Channel Mode", |
| 2830 | .info = alc_ch_mode_info, |
| 2831 | .get = alc_ch_mode_get, |
| 2832 | .put = alc_ch_mode_put, |
| 2833 | }, |
| 2834 | { } /* end */ |
| 2835 | }; |
| 2836 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2837 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2838 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2839 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2840 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2841 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2842 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2843 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2844 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2845 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2846 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2847 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2848 | { } /* end */ |
| 2849 | }; |
| 2850 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2851 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2852 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2853 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2854 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2855 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2856 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2858 | { } /* end */ |
| 2859 | }; |
| 2860 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2861 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2862 | * virtual master controls |
| 2863 | */ |
| 2864 | |
| 2865 | /* |
| 2866 | * slave controls for virtual master |
| 2867 | */ |
| 2868 | static const char *alc_slave_vols[] = { |
| 2869 | "Front Playback Volume", |
| 2870 | "Surround Playback Volume", |
| 2871 | "Center Playback Volume", |
| 2872 | "LFE Playback Volume", |
| 2873 | "Side Playback Volume", |
| 2874 | "Headphone Playback Volume", |
| 2875 | "Speaker Playback Volume", |
| 2876 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2877 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2878 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2879 | NULL, |
| 2880 | }; |
| 2881 | |
| 2882 | static const char *alc_slave_sws[] = { |
| 2883 | "Front Playback Switch", |
| 2884 | "Surround Playback Switch", |
| 2885 | "Center Playback Switch", |
| 2886 | "LFE Playback Switch", |
| 2887 | "Side Playback Switch", |
| 2888 | "Headphone Playback Switch", |
| 2889 | "Speaker Playback Switch", |
| 2890 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2891 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2892 | "Line-Out Playback Switch", |
| 2893 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2894 | NULL, |
| 2895 | }; |
| 2896 | |
| 2897 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2898 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2899 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2900 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2901 | #define NID_MAPPING (-1) |
| 2902 | |
| 2903 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2904 | #define SUBDEV_HP_ (1 << 6) |
| 2905 | #define SUBDEV_LINE_ (2 << 6) |
| 2906 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2907 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2908 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2909 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2910 | static void alc_free_kctls(struct hda_codec *codec); |
| 2911 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2912 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2913 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2914 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2915 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2916 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2917 | { } /* end */ |
| 2918 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2919 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2920 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2921 | static int alc_build_controls(struct hda_codec *codec) |
| 2922 | { |
| 2923 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2924 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2925 | struct snd_kcontrol_new *knew; |
| 2926 | int i, j, err; |
| 2927 | unsigned int u; |
| 2928 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2929 | |
| 2930 | for (i = 0; i < spec->num_mixers; i++) { |
| 2931 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2932 | if (err < 0) |
| 2933 | return err; |
| 2934 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2935 | if (spec->cap_mixer) { |
| 2936 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2937 | if (err < 0) |
| 2938 | return err; |
| 2939 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2940 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2941 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2942 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2943 | if (err < 0) |
| 2944 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2945 | if (!spec->no_analog) { |
| 2946 | err = snd_hda_create_spdif_share_sw(codec, |
| 2947 | &spec->multiout); |
| 2948 | if (err < 0) |
| 2949 | return err; |
| 2950 | spec->multiout.share_spdif = 1; |
| 2951 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2952 | } |
| 2953 | if (spec->dig_in_nid) { |
| 2954 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2955 | if (err < 0) |
| 2956 | return err; |
| 2957 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2958 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2959 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2960 | /* create beep controls if needed */ |
| 2961 | if (spec->beep_amp) { |
| 2962 | struct snd_kcontrol_new *knew; |
| 2963 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2964 | struct snd_kcontrol *kctl; |
| 2965 | kctl = snd_ctl_new1(knew, codec); |
| 2966 | if (!kctl) |
| 2967 | return -ENOMEM; |
| 2968 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2969 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2970 | if (err < 0) |
| 2971 | return err; |
| 2972 | } |
| 2973 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2974 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2975 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2976 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2977 | if (!spec->no_analog && |
| 2978 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2979 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2980 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2981 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2982 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2983 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2984 | if (err < 0) |
| 2985 | return err; |
| 2986 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2987 | if (!spec->no_analog && |
| 2988 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2989 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2990 | NULL, alc_slave_sws); |
| 2991 | if (err < 0) |
| 2992 | return err; |
| 2993 | } |
| 2994 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2995 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2996 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2997 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2998 | if (!kctl) |
| 2999 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3000 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3001 | hda_nid_t *nids = spec->capsrc_nids; |
| 3002 | if (!nids) |
| 3003 | nids = spec->adc_nids; |
| 3004 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3005 | if (err < 0) |
| 3006 | return err; |
| 3007 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3008 | } |
| 3009 | if (spec->cap_mixer) { |
| 3010 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3011 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3012 | if (kname && strcmp(knew->name, kname) == 0) |
| 3013 | continue; |
| 3014 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3015 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3016 | err = snd_hda_add_nid(codec, kctl, i, |
| 3017 | spec->adc_nids[i]); |
| 3018 | if (err < 0) |
| 3019 | return err; |
| 3020 | } |
| 3021 | } |
| 3022 | } |
| 3023 | |
| 3024 | /* other nid->control mapping */ |
| 3025 | for (i = 0; i < spec->num_mixers; i++) { |
| 3026 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3027 | if (knew->iface != NID_MAPPING) |
| 3028 | continue; |
| 3029 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3030 | if (kctl == NULL) |
| 3031 | continue; |
| 3032 | u = knew->subdevice; |
| 3033 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3034 | nid = u & 0x3f; |
| 3035 | if (nid == 0) |
| 3036 | continue; |
| 3037 | switch (u & 0xc0) { |
| 3038 | case SUBDEV_SPEAKER_: |
| 3039 | nid = spec->autocfg.speaker_pins[nid]; |
| 3040 | break; |
| 3041 | case SUBDEV_LINE_: |
| 3042 | nid = spec->autocfg.line_out_pins[nid]; |
| 3043 | break; |
| 3044 | case SUBDEV_HP_: |
| 3045 | nid = spec->autocfg.hp_pins[nid]; |
| 3046 | break; |
| 3047 | default: |
| 3048 | continue; |
| 3049 | } |
| 3050 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3051 | if (err < 0) |
| 3052 | return err; |
| 3053 | } |
| 3054 | u = knew->private_value; |
| 3055 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3056 | nid = u & 0xff; |
| 3057 | if (nid == 0) |
| 3058 | continue; |
| 3059 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3060 | if (err < 0) |
| 3061 | return err; |
| 3062 | } |
| 3063 | } |
| 3064 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3065 | |
| 3066 | alc_free_kctls(codec); /* no longer needed */ |
| 3067 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3068 | return 0; |
| 3069 | } |
| 3070 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3071 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3072 | /* |
| 3073 | * initialize the codec volumes, etc |
| 3074 | */ |
| 3075 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3076 | /* |
| 3077 | * generic initialization of ADC, input mixers and output mixers |
| 3078 | */ |
| 3079 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3080 | /* |
| 3081 | * Unmute ADC0-2 and set the default input to mic-in |
| 3082 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3083 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3084 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3085 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3086 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3087 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3088 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3089 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3090 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3091 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3092 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3093 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3094 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3095 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3103 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3104 | /* |
| 3105 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3106 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3107 | /* set vol=0 to output mixers */ |
| 3108 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3109 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3111 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3112 | /* set up input amps for analog loopback */ |
| 3113 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3116 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3117 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3118 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3119 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3120 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3121 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3122 | |
| 3123 | { } |
| 3124 | }; |
| 3125 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3126 | /* |
| 3127 | * 3-stack pin configuration: |
| 3128 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3129 | */ |
| 3130 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3131 | /* |
| 3132 | * preset connection lists of input pins |
| 3133 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3134 | */ |
| 3135 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3136 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3137 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3138 | |
| 3139 | /* |
| 3140 | * Set pin mode and muting |
| 3141 | */ |
| 3142 | /* set front pin widgets 0x14 for output */ |
| 3143 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3144 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3145 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3146 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3147 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3148 | /* Mic2 (as headphone out) for HP output */ |
| 3149 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3150 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3151 | /* Line In pin widget for input */ |
| 3152 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3153 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3154 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3155 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3156 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3157 | /* CD pin widget for input */ |
| 3158 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3159 | |
| 3160 | { } |
| 3161 | }; |
| 3162 | |
| 3163 | /* |
| 3164 | * 5-stack pin configuration: |
| 3165 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3166 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3167 | */ |
| 3168 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3169 | /* |
| 3170 | * preset connection lists of input pins |
| 3171 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3172 | */ |
| 3173 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3174 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3175 | |
| 3176 | /* |
| 3177 | * Set pin mode and muting |
| 3178 | */ |
| 3179 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3180 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3181 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3182 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3183 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3184 | /* unmute pins for output (no gain on this amp) */ |
| 3185 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3186 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3187 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3188 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3189 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3190 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3191 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3192 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3193 | /* Mic2 (as headphone out) for HP output */ |
| 3194 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3195 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3196 | /* Line In pin widget for input */ |
| 3197 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3198 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3199 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3200 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3201 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3202 | /* CD pin widget for input */ |
| 3203 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3204 | |
| 3205 | { } |
| 3206 | }; |
| 3207 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3208 | /* |
| 3209 | * W810 pin configuration: |
| 3210 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3211 | */ |
| 3212 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3213 | /* hphone/speaker input selector: front DAC */ |
| 3214 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3215 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3216 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3217 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3219 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3220 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3221 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3222 | |
| 3223 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3224 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3225 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3226 | { } |
| 3227 | }; |
| 3228 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3229 | /* |
| 3230 | * Z71V pin configuration: |
| 3231 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3232 | */ |
| 3233 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3235 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3238 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3239 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3240 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3241 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3242 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3243 | |
| 3244 | { } |
| 3245 | }; |
| 3246 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3247 | /* |
| 3248 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3249 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3250 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3251 | */ |
| 3252 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3253 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3254 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3255 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3256 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3257 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3258 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3259 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3260 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3261 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3262 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3263 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3264 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3265 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3266 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3267 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3268 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3269 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3270 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3271 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3272 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3273 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3274 | { } |
| 3275 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3276 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3277 | /* |
| 3278 | * Uniwill pin configuration: |
| 3279 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3280 | * line = 0x1a |
| 3281 | */ |
| 3282 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3283 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3284 | |
| 3285 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3286 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3287 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3288 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3289 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3290 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3291 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3292 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3296 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3299 | |
| 3300 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3301 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3302 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3303 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3305 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3306 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3307 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3308 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3309 | |
| 3310 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3311 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3312 | |
| 3313 | { } |
| 3314 | }; |
| 3315 | |
| 3316 | /* |
| 3317 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3318 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3319 | */ |
| 3320 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3321 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3322 | |
| 3323 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3324 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3325 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3326 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3327 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3328 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3329 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3330 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3331 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3335 | |
| 3336 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3337 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3338 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3339 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3340 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3341 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3342 | |
| 3343 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3344 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3345 | |
| 3346 | { } |
| 3347 | }; |
| 3348 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3349 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3350 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3351 | { } |
| 3352 | }; |
| 3353 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3354 | /* auto-toggle front mic */ |
| 3355 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 3356 | { |
| 3357 | unsigned int present; |
| 3358 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3359 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3360 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3361 | bits = present ? HDA_AMP_MUTE : 0; |
| 3362 | 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] | 3363 | } |
| 3364 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3365 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3366 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3367 | struct alc_spec *spec = codec->spec; |
| 3368 | |
| 3369 | spec->autocfg.hp_pins[0] = 0x14; |
| 3370 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3371 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3372 | } |
| 3373 | |
| 3374 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3375 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3376 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3377 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3378 | } |
| 3379 | |
| 3380 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3381 | unsigned int res) |
| 3382 | { |
| 3383 | /* Looks like the unsol event is incompatible with the standard |
| 3384 | * definition. 4bit tag is placed at 28 bit! |
| 3385 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3386 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3387 | case ALC880_MIC_EVENT: |
| 3388 | alc880_uniwill_mic_automute(codec); |
| 3389 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3390 | default: |
| 3391 | alc_automute_amp_unsol_event(codec, res); |
| 3392 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3393 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3394 | } |
| 3395 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3396 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3397 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3398 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3399 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3400 | spec->autocfg.hp_pins[0] = 0x14; |
| 3401 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3402 | } |
| 3403 | |
| 3404 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3405 | { |
| 3406 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3407 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3408 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3409 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3410 | present &= HDA_AMP_VOLMASK; |
| 3411 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3412 | HDA_AMP_VOLMASK, present); |
| 3413 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3414 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3415 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3416 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3417 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3418 | unsigned int res) |
| 3419 | { |
| 3420 | /* Looks like the unsol event is incompatible with the standard |
| 3421 | * definition. 4bit tag is placed at 28 bit! |
| 3422 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3423 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3424 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3425 | else |
| 3426 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3427 | } |
| 3428 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3429 | /* |
| 3430 | * F1734 pin configuration: |
| 3431 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3432 | */ |
| 3433 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3434 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3435 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3436 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3437 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3438 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3439 | |
| 3440 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3441 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3442 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3443 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3444 | |
| 3445 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3446 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3447 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3448 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3449 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3450 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3451 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3452 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3453 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3454 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3455 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3456 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3457 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3458 | { } |
| 3459 | }; |
| 3460 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3461 | /* |
| 3462 | * ASUS pin configuration: |
| 3463 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3464 | */ |
| 3465 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3466 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3467 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3468 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3469 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3470 | |
| 3471 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3472 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3473 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3474 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3475 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3476 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3477 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3478 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3479 | |
| 3480 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3481 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3482 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3483 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3484 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3485 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3486 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3488 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3489 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3490 | { } |
| 3491 | }; |
| 3492 | |
| 3493 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3494 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3495 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3496 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3497 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3498 | /* Clevo m520g init */ |
| 3499 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3500 | /* headphone output */ |
| 3501 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3502 | /* line-out */ |
| 3503 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3504 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3505 | /* Line-in */ |
| 3506 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3507 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3508 | /* CD */ |
| 3509 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3510 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3511 | /* Mic1 (rear panel) */ |
| 3512 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3513 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3514 | /* Mic2 (front panel) */ |
| 3515 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3516 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3517 | /* headphone */ |
| 3518 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3519 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3520 | /* change to EAPD mode */ |
| 3521 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3522 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3523 | |
| 3524 | { } |
| 3525 | }; |
| 3526 | |
| 3527 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3528 | /* change to EAPD mode */ |
| 3529 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3530 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3531 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3532 | /* Headphone output */ |
| 3533 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3534 | /* Front output*/ |
| 3535 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3536 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3537 | |
| 3538 | /* Line In pin widget for input */ |
| 3539 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3540 | /* CD pin widget for input */ |
| 3541 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3542 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3543 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3544 | |
| 3545 | /* change to EAPD mode */ |
| 3546 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3547 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3548 | |
| 3549 | { } |
| 3550 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3551 | |
| 3552 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3553 | * LG m1 express dual |
| 3554 | * |
| 3555 | * Pin assignment: |
| 3556 | * Rear Line-In/Out (blue): 0x14 |
| 3557 | * Build-in Mic-In: 0x15 |
| 3558 | * Speaker-out: 0x17 |
| 3559 | * HP-Out (green): 0x1b |
| 3560 | * Mic-In/Out (red): 0x19 |
| 3561 | * SPDIF-Out: 0x1e |
| 3562 | */ |
| 3563 | |
| 3564 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3565 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3566 | 0x05, 0x02, 0x03 |
| 3567 | }; |
| 3568 | |
| 3569 | /* seems analog CD is not working */ |
| 3570 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3571 | .num_items = 3, |
| 3572 | .items = { |
| 3573 | { "Mic", 0x1 }, |
| 3574 | { "Line", 0x5 }, |
| 3575 | { "Internal Mic", 0x6 }, |
| 3576 | }, |
| 3577 | }; |
| 3578 | |
| 3579 | /* 2,4,6 channel modes */ |
| 3580 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3581 | /* set line-in and mic-in to input */ |
| 3582 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3583 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3584 | { } |
| 3585 | }; |
| 3586 | |
| 3587 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3588 | /* set line-in to out and mic-in to input */ |
| 3589 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3590 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3591 | { } |
| 3592 | }; |
| 3593 | |
| 3594 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3595 | /* set line-in and mic-in to output */ |
| 3596 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3597 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3598 | { } |
| 3599 | }; |
| 3600 | |
| 3601 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3602 | { 2, alc880_lg_ch2_init }, |
| 3603 | { 4, alc880_lg_ch4_init }, |
| 3604 | { 6, alc880_lg_ch6_init }, |
| 3605 | }; |
| 3606 | |
| 3607 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3608 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3609 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3610 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3611 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3612 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3613 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3614 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3615 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3618 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3619 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3620 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3621 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3622 | { |
| 3623 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3624 | .name = "Channel Mode", |
| 3625 | .info = alc_ch_mode_info, |
| 3626 | .get = alc_ch_mode_get, |
| 3627 | .put = alc_ch_mode_put, |
| 3628 | }, |
| 3629 | { } /* end */ |
| 3630 | }; |
| 3631 | |
| 3632 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3633 | /* set capture source to mic-in */ |
| 3634 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3635 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3636 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3637 | /* mute all amp mixer inputs */ |
| 3638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3641 | /* line-in to input */ |
| 3642 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3643 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3644 | /* built-in mic */ |
| 3645 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3647 | /* speaker-out */ |
| 3648 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3649 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3650 | /* mic-in to input */ |
| 3651 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3652 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3653 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3654 | /* HP-out */ |
| 3655 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3656 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3657 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3658 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3659 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3660 | { } |
| 3661 | }; |
| 3662 | |
| 3663 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3664 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3665 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3666 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3667 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3668 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3669 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3670 | } |
| 3671 | |
| 3672 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3673 | * LG LW20 |
| 3674 | * |
| 3675 | * Pin assignment: |
| 3676 | * Speaker-out: 0x14 |
| 3677 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3678 | * Built-in Mic-In: 0x19 |
| 3679 | * Line-In: 0x1b |
| 3680 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3681 | * SPDIF-Out: 0x1e |
| 3682 | */ |
| 3683 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3684 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3685 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3686 | .items = { |
| 3687 | { "Mic", 0x0 }, |
| 3688 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3689 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3690 | }, |
| 3691 | }; |
| 3692 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3693 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3694 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3695 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3697 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3698 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3699 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3700 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3701 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3702 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3703 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3704 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3705 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3708 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3709 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3710 | { |
| 3711 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3712 | .name = "Channel Mode", |
| 3713 | .info = alc_ch_mode_info, |
| 3714 | .get = alc_ch_mode_get, |
| 3715 | .put = alc_ch_mode_put, |
| 3716 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3717 | { } /* end */ |
| 3718 | }; |
| 3719 | |
| 3720 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3721 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3722 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3723 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3724 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3725 | /* set capture source to mic-in */ |
| 3726 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3727 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3728 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3729 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3730 | /* speaker-out */ |
| 3731 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3732 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3733 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3734 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3735 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3736 | /* mic-in to input */ |
| 3737 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3738 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3739 | /* built-in mic */ |
| 3740 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3741 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3742 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3743 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3744 | { } |
| 3745 | }; |
| 3746 | |
| 3747 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3748 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3749 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3750 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3751 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3752 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3753 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3754 | } |
| 3755 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3756 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3757 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3758 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3760 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3761 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3762 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3763 | { } /* end */ |
| 3764 | }; |
| 3765 | |
| 3766 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3767 | .num_items = 2, |
| 3768 | .items = { |
| 3769 | { "Mic", 0x0 }, |
| 3770 | { "Internal Mic", 0x1 }, |
| 3771 | }, |
| 3772 | }; |
| 3773 | |
| 3774 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3775 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3776 | |
| 3777 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3778 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3779 | |
| 3780 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3781 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3782 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3783 | /* Mic2 (as headphone out) for HP output */ |
| 3784 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3785 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3786 | /* Internal Speaker */ |
| 3787 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3788 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3789 | |
| 3790 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3791 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3792 | |
| 3793 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3794 | { } |
| 3795 | }; |
| 3796 | |
| 3797 | /* toggle speaker-output according to the hp-jack state */ |
| 3798 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3799 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3800 | struct alc_spec *spec = codec->spec; |
| 3801 | alc_automute_amp(codec); |
| 3802 | /* toggle EAPD */ |
| 3803 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3804 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3805 | else |
| 3806 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3807 | } |
| 3808 | |
| 3809 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3810 | unsigned int res) |
| 3811 | { |
| 3812 | /* Looks like the unsol event is incompatible with the standard |
| 3813 | * definition. 4bit tag is placed at 28 bit! |
| 3814 | */ |
| 3815 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3816 | alc880_medion_rim_automute(codec); |
| 3817 | } |
| 3818 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3819 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3820 | { |
| 3821 | struct alc_spec *spec = codec->spec; |
| 3822 | |
| 3823 | spec->autocfg.hp_pins[0] = 0x14; |
| 3824 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3825 | } |
| 3826 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3827 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3828 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3829 | { 0x0b, HDA_INPUT, 0 }, |
| 3830 | { 0x0b, HDA_INPUT, 1 }, |
| 3831 | { 0x0b, HDA_INPUT, 2 }, |
| 3832 | { 0x0b, HDA_INPUT, 3 }, |
| 3833 | { 0x0b, HDA_INPUT, 4 }, |
| 3834 | { } /* end */ |
| 3835 | }; |
| 3836 | |
| 3837 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3838 | { 0x0b, HDA_INPUT, 1 }, |
| 3839 | { 0x0b, HDA_INPUT, 6 }, |
| 3840 | { 0x0b, HDA_INPUT, 7 }, |
| 3841 | { } /* end */ |
| 3842 | }; |
| 3843 | #endif |
| 3844 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3845 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3846 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3847 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3848 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3849 | static int alc_init(struct hda_codec *codec) |
| 3850 | { |
| 3851 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3852 | unsigned int i; |
| 3853 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3854 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3855 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3856 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3857 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3858 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3859 | |
| 3860 | if (spec->init_hook) |
| 3861 | spec->init_hook(codec); |
| 3862 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3863 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3864 | return 0; |
| 3865 | } |
| 3866 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3867 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3868 | { |
| 3869 | struct alc_spec *spec = codec->spec; |
| 3870 | |
| 3871 | if (spec->unsol_event) |
| 3872 | spec->unsol_event(codec, res); |
| 3873 | } |
| 3874 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3875 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3876 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3877 | { |
| 3878 | struct alc_spec *spec = codec->spec; |
| 3879 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3880 | } |
| 3881 | #endif |
| 3882 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3883 | /* |
| 3884 | * Analog playback callbacks |
| 3885 | */ |
| 3886 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3887 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3888 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3889 | { |
| 3890 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3891 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3892 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3893 | } |
| 3894 | |
| 3895 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3896 | struct hda_codec *codec, |
| 3897 | unsigned int stream_tag, |
| 3898 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3899 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3900 | { |
| 3901 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3902 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3903 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3904 | } |
| 3905 | |
| 3906 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3907 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3908 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3909 | { |
| 3910 | struct alc_spec *spec = codec->spec; |
| 3911 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3912 | } |
| 3913 | |
| 3914 | /* |
| 3915 | * Digital out |
| 3916 | */ |
| 3917 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3918 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3919 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3920 | { |
| 3921 | struct alc_spec *spec = codec->spec; |
| 3922 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3923 | } |
| 3924 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3925 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3926 | struct hda_codec *codec, |
| 3927 | unsigned int stream_tag, |
| 3928 | unsigned int format, |
| 3929 | struct snd_pcm_substream *substream) |
| 3930 | { |
| 3931 | struct alc_spec *spec = codec->spec; |
| 3932 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3933 | stream_tag, format, substream); |
| 3934 | } |
| 3935 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3936 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3937 | struct hda_codec *codec, |
| 3938 | struct snd_pcm_substream *substream) |
| 3939 | { |
| 3940 | struct alc_spec *spec = codec->spec; |
| 3941 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3942 | } |
| 3943 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3944 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3945 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3946 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3947 | { |
| 3948 | struct alc_spec *spec = codec->spec; |
| 3949 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3950 | } |
| 3951 | |
| 3952 | /* |
| 3953 | * Analog capture |
| 3954 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3955 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3956 | struct hda_codec *codec, |
| 3957 | unsigned int stream_tag, |
| 3958 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3959 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3960 | { |
| 3961 | struct alc_spec *spec = codec->spec; |
| 3962 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3963 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3964 | stream_tag, 0, format); |
| 3965 | return 0; |
| 3966 | } |
| 3967 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3968 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3969 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3970 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3971 | { |
| 3972 | struct alc_spec *spec = codec->spec; |
| 3973 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3974 | snd_hda_codec_cleanup_stream(codec, |
| 3975 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3976 | return 0; |
| 3977 | } |
| 3978 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3979 | /* analog capture with dynamic dual-adc changes */ |
| 3980 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3981 | struct hda_codec *codec, |
| 3982 | unsigned int stream_tag, |
| 3983 | unsigned int format, |
| 3984 | struct snd_pcm_substream *substream) |
| 3985 | { |
| 3986 | struct alc_spec *spec = codec->spec; |
| 3987 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3988 | spec->cur_adc_stream_tag = stream_tag; |
| 3989 | spec->cur_adc_format = format; |
| 3990 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3991 | return 0; |
| 3992 | } |
| 3993 | |
| 3994 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3995 | struct hda_codec *codec, |
| 3996 | struct snd_pcm_substream *substream) |
| 3997 | { |
| 3998 | struct alc_spec *spec = codec->spec; |
| 3999 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4000 | spec->cur_adc = 0; |
| 4001 | return 0; |
| 4002 | } |
| 4003 | |
| 4004 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4005 | .substreams = 1, |
| 4006 | .channels_min = 2, |
| 4007 | .channels_max = 2, |
| 4008 | .nid = 0, /* fill later */ |
| 4009 | .ops = { |
| 4010 | .prepare = dualmic_capture_pcm_prepare, |
| 4011 | .cleanup = dualmic_capture_pcm_cleanup |
| 4012 | }, |
| 4013 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4014 | |
| 4015 | /* |
| 4016 | */ |
| 4017 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4018 | .substreams = 1, |
| 4019 | .channels_min = 2, |
| 4020 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4021 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4022 | .ops = { |
| 4023 | .open = alc880_playback_pcm_open, |
| 4024 | .prepare = alc880_playback_pcm_prepare, |
| 4025 | .cleanup = alc880_playback_pcm_cleanup |
| 4026 | }, |
| 4027 | }; |
| 4028 | |
| 4029 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4030 | .substreams = 1, |
| 4031 | .channels_min = 2, |
| 4032 | .channels_max = 2, |
| 4033 | /* NID is set in alc_build_pcms */ |
| 4034 | }; |
| 4035 | |
| 4036 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4037 | .substreams = 1, |
| 4038 | .channels_min = 2, |
| 4039 | .channels_max = 2, |
| 4040 | /* NID is set in alc_build_pcms */ |
| 4041 | }; |
| 4042 | |
| 4043 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4044 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4045 | .channels_min = 2, |
| 4046 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4047 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4048 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4049 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4050 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4051 | }, |
| 4052 | }; |
| 4053 | |
| 4054 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4055 | .substreams = 1, |
| 4056 | .channels_min = 2, |
| 4057 | .channels_max = 2, |
| 4058 | /* NID is set in alc_build_pcms */ |
| 4059 | .ops = { |
| 4060 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4061 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4062 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4063 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4064 | }, |
| 4065 | }; |
| 4066 | |
| 4067 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4068 | .substreams = 1, |
| 4069 | .channels_min = 2, |
| 4070 | .channels_max = 2, |
| 4071 | /* NID is set in alc_build_pcms */ |
| 4072 | }; |
| 4073 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4074 | /* 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] | 4075 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4076 | .substreams = 0, |
| 4077 | .channels_min = 0, |
| 4078 | .channels_max = 0, |
| 4079 | }; |
| 4080 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4081 | static int alc_build_pcms(struct hda_codec *codec) |
| 4082 | { |
| 4083 | struct alc_spec *spec = codec->spec; |
| 4084 | struct hda_pcm *info = spec->pcm_rec; |
| 4085 | int i; |
| 4086 | |
| 4087 | codec->num_pcms = 1; |
| 4088 | codec->pcm_info = info; |
| 4089 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4090 | if (spec->no_analog) |
| 4091 | goto skip_analog; |
| 4092 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4093 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4094 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4095 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4096 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4097 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4098 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4099 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4100 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4101 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4102 | } |
| 4103 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4104 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4105 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4106 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4107 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4108 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4109 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4110 | if (spec->channel_mode) { |
| 4111 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4112 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4113 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4114 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4115 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4116 | } |
| 4117 | } |
| 4118 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4119 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4120 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4121 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4122 | snprintf(spec->stream_name_digital, |
| 4123 | sizeof(spec->stream_name_digital), |
| 4124 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4125 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4126 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4127 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4128 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4129 | if (spec->dig_out_type) |
| 4130 | info->pcm_type = spec->dig_out_type; |
| 4131 | else |
| 4132 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4133 | if (spec->multiout.dig_out_nid && |
| 4134 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4135 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4136 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4137 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4138 | if (spec->dig_in_nid && |
| 4139 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4140 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4141 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4142 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4143 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4144 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4145 | } |
| 4146 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4147 | if (spec->no_analog) |
| 4148 | return 0; |
| 4149 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4150 | /* If the use of more than one ADC is requested for the current |
| 4151 | * model, configure a second analog capture-only PCM. |
| 4152 | */ |
| 4153 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4154 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4155 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4156 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4157 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4158 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4159 | if (spec->alt_dac_nid) { |
| 4160 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4161 | *spec->stream_analog_alt_playback; |
| 4162 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4163 | spec->alt_dac_nid; |
| 4164 | } else { |
| 4165 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4166 | alc_pcm_null_stream; |
| 4167 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4168 | } |
| 4169 | if (spec->num_adc_nids > 1) { |
| 4170 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4171 | *spec->stream_analog_alt_capture; |
| 4172 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4173 | spec->adc_nids[1]; |
| 4174 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4175 | spec->num_adc_nids - 1; |
| 4176 | } else { |
| 4177 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4178 | alc_pcm_null_stream; |
| 4179 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4180 | } |
| 4181 | } |
| 4182 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4183 | return 0; |
| 4184 | } |
| 4185 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4186 | static inline void alc_shutup(struct hda_codec *codec) |
| 4187 | { |
| 4188 | snd_hda_shutup_pins(codec); |
| 4189 | } |
| 4190 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4191 | static void alc_free_kctls(struct hda_codec *codec) |
| 4192 | { |
| 4193 | struct alc_spec *spec = codec->spec; |
| 4194 | |
| 4195 | if (spec->kctls.list) { |
| 4196 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4197 | int i; |
| 4198 | for (i = 0; i < spec->kctls.used; i++) |
| 4199 | kfree(kctl[i].name); |
| 4200 | } |
| 4201 | snd_array_free(&spec->kctls); |
| 4202 | } |
| 4203 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4204 | static void alc_free(struct hda_codec *codec) |
| 4205 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4206 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4207 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4208 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4209 | return; |
| 4210 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4211 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4212 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4213 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4214 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4215 | } |
| 4216 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4217 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4218 | static void alc_power_eapd(struct hda_codec *codec) |
| 4219 | { |
| 4220 | /* We currently only handle front, HP */ |
| 4221 | switch (codec->vendor_id) { |
| 4222 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4223 | set_eapd(codec, 0x0f, 0); |
| 4224 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4225 | break; |
| 4226 | case 0x10ec0262: |
| 4227 | case 0x10ec0267: |
| 4228 | case 0x10ec0268: |
| 4229 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4230 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4231 | case 0x10ec0272: |
| 4232 | case 0x10ec0660: |
| 4233 | case 0x10ec0662: |
| 4234 | case 0x10ec0663: |
| 4235 | case 0x10ec0862: |
| 4236 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4237 | set_eapd(codec, 0x14, 0); |
| 4238 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4239 | break; |
| 4240 | } |
| 4241 | } |
| 4242 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4243 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4244 | { |
| 4245 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4246 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4247 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4248 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4249 | return 0; |
| 4250 | } |
| 4251 | #endif |
| 4252 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4253 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4254 | static int alc_resume(struct hda_codec *codec) |
| 4255 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4256 | codec->patch_ops.init(codec); |
| 4257 | snd_hda_codec_resume_amp(codec); |
| 4258 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4259 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4260 | return 0; |
| 4261 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4262 | #endif |
| 4263 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4264 | /* |
| 4265 | */ |
| 4266 | static struct hda_codec_ops alc_patch_ops = { |
| 4267 | .build_controls = alc_build_controls, |
| 4268 | .build_pcms = alc_build_pcms, |
| 4269 | .init = alc_init, |
| 4270 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4271 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4272 | #ifdef SND_HDA_NEEDS_RESUME |
| 4273 | .resume = alc_resume, |
| 4274 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4275 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4276 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4277 | .check_power_status = alc_check_power_status, |
| 4278 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4279 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4280 | }; |
| 4281 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4282 | /* replace the codec chip_name with the given string */ |
| 4283 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4284 | { |
| 4285 | kfree(codec->chip_name); |
| 4286 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4287 | if (!codec->chip_name) { |
| 4288 | alc_free(codec); |
| 4289 | return -ENOMEM; |
| 4290 | } |
| 4291 | return 0; |
| 4292 | } |
| 4293 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4294 | /* |
| 4295 | * Test configuration for debugging |
| 4296 | * |
| 4297 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4298 | * enum controls. |
| 4299 | */ |
| 4300 | #ifdef CONFIG_SND_DEBUG |
| 4301 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4302 | 0x02, 0x03, 0x04, 0x05 |
| 4303 | }; |
| 4304 | |
| 4305 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4306 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4307 | .items = { |
| 4308 | { "In-1", 0x0 }, |
| 4309 | { "In-2", 0x1 }, |
| 4310 | { "In-3", 0x2 }, |
| 4311 | { "In-4", 0x3 }, |
| 4312 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4313 | { "Front", 0x5 }, |
| 4314 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4315 | }, |
| 4316 | }; |
| 4317 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4318 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4319 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4320 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4321 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4322 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4323 | }; |
| 4324 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4325 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4326 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4327 | { |
| 4328 | static char *texts[] = { |
| 4329 | "N/A", "Line Out", "HP Out", |
| 4330 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4331 | }; |
| 4332 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4333 | uinfo->count = 1; |
| 4334 | uinfo->value.enumerated.items = 8; |
| 4335 | if (uinfo->value.enumerated.item >= 8) |
| 4336 | uinfo->value.enumerated.item = 7; |
| 4337 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4338 | return 0; |
| 4339 | } |
| 4340 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4341 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4342 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4343 | { |
| 4344 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4345 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4346 | unsigned int pin_ctl, item = 0; |
| 4347 | |
| 4348 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4349 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4350 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4351 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4352 | item = 2; |
| 4353 | else |
| 4354 | item = 1; |
| 4355 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4356 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4357 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4358 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4359 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4360 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4361 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4362 | } |
| 4363 | } |
| 4364 | ucontrol->value.enumerated.item[0] = item; |
| 4365 | return 0; |
| 4366 | } |
| 4367 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4368 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4369 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4370 | { |
| 4371 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4372 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4373 | static unsigned int ctls[] = { |
| 4374 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4375 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4376 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4377 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4378 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4379 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4380 | }; |
| 4381 | unsigned int old_ctl, new_ctl; |
| 4382 | |
| 4383 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4384 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4385 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4386 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4387 | int val; |
| 4388 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4389 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4390 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4391 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4392 | HDA_AMP_MUTE : 0; |
| 4393 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4394 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4395 | return 1; |
| 4396 | } |
| 4397 | return 0; |
| 4398 | } |
| 4399 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4400 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4401 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4402 | { |
| 4403 | static char *texts[] = { |
| 4404 | "Front", "Surround", "CLFE", "Side" |
| 4405 | }; |
| 4406 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4407 | uinfo->count = 1; |
| 4408 | uinfo->value.enumerated.items = 4; |
| 4409 | if (uinfo->value.enumerated.item >= 4) |
| 4410 | uinfo->value.enumerated.item = 3; |
| 4411 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4412 | return 0; |
| 4413 | } |
| 4414 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4415 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4416 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4417 | { |
| 4418 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4419 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4420 | unsigned int sel; |
| 4421 | |
| 4422 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4423 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4424 | return 0; |
| 4425 | } |
| 4426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4427 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4428 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4429 | { |
| 4430 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4431 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4432 | unsigned int sel; |
| 4433 | |
| 4434 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4435 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4436 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4437 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4438 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4439 | return 1; |
| 4440 | } |
| 4441 | return 0; |
| 4442 | } |
| 4443 | |
| 4444 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4445 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4446 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4447 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4448 | .info = alc_test_pin_ctl_info, \ |
| 4449 | .get = alc_test_pin_ctl_get, \ |
| 4450 | .put = alc_test_pin_ctl_put, \ |
| 4451 | .private_value = nid \ |
| 4452 | } |
| 4453 | |
| 4454 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4455 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4456 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4457 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4458 | .info = alc_test_pin_src_info, \ |
| 4459 | .get = alc_test_pin_src_get, \ |
| 4460 | .put = alc_test_pin_src_put, \ |
| 4461 | .private_value = nid \ |
| 4462 | } |
| 4463 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4464 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4465 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4466 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4467 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4468 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4469 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4470 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4471 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4472 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4473 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4474 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4475 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4476 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4477 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4478 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4479 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4480 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4481 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4482 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4483 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4484 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4485 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4486 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4487 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4488 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4489 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4490 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4491 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4492 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4493 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4494 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4495 | { |
| 4496 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4497 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4498 | .info = alc_ch_mode_info, |
| 4499 | .get = alc_ch_mode_get, |
| 4500 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4501 | }, |
| 4502 | { } /* end */ |
| 4503 | }; |
| 4504 | |
| 4505 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4506 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4507 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4508 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4509 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4510 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4511 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4512 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4513 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4514 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4515 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4516 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4517 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4518 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4519 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4520 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4521 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4522 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4523 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4524 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4525 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4526 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4527 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4528 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4529 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4530 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4531 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4532 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4533 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4534 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4535 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4536 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4537 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4538 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4539 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4540 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4541 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4542 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4543 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4544 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4545 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4546 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4547 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4548 | /* Analog input/passthru */ |
| 4549 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4550 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4551 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4552 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4553 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4554 | { } |
| 4555 | }; |
| 4556 | #endif |
| 4557 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4558 | /* |
| 4559 | */ |
| 4560 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4561 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4562 | [ALC880_3ST] = "3stack", |
| 4563 | [ALC880_TCL_S700] = "tcl", |
| 4564 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4565 | [ALC880_CLEVO] = "clevo", |
| 4566 | [ALC880_5ST] = "5stack", |
| 4567 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4568 | [ALC880_W810] = "w810", |
| 4569 | [ALC880_Z71V] = "z71v", |
| 4570 | [ALC880_6ST] = "6stack", |
| 4571 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4572 | [ALC880_ASUS] = "asus", |
| 4573 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4574 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4575 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4576 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4577 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4578 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4579 | [ALC880_F1734] = "F1734", |
| 4580 | [ALC880_LG] = "lg", |
| 4581 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4582 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4583 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4584 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4585 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4586 | [ALC880_AUTO] = "auto", |
| 4587 | }; |
| 4588 | |
| 4589 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4590 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4591 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4592 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4593 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4594 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4595 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4596 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4597 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4598 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4599 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4600 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4601 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4602 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4603 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4604 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4605 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4606 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4607 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4608 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4609 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4610 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4611 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4612 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4613 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4614 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4615 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4616 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4617 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4618 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4619 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4620 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4621 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4622 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4623 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4624 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4625 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4626 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4627 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4628 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4629 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4630 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4631 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4632 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4633 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4634 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4635 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4636 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4637 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4638 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4639 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4640 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4641 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4642 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4643 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4644 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4645 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4646 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4647 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4648 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4649 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4650 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4651 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4652 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4653 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4654 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4655 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4656 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4657 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4658 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4659 | /* default Intel */ |
| 4660 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4661 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4662 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4663 | {} |
| 4664 | }; |
| 4665 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4666 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4667 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4668 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4669 | static struct alc_config_preset alc880_presets[] = { |
| 4670 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4671 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4672 | .init_verbs = { alc880_volume_init_verbs, |
| 4673 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4674 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4675 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4676 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4677 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4678 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4679 | .input_mux = &alc880_capture_source, |
| 4680 | }, |
| 4681 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4682 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4683 | .init_verbs = { alc880_volume_init_verbs, |
| 4684 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4685 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4686 | .dac_nids = alc880_dac_nids, |
| 4687 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4688 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4689 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4690 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4691 | .input_mux = &alc880_capture_source, |
| 4692 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4693 | [ALC880_TCL_S700] = { |
| 4694 | .mixers = { alc880_tcl_s700_mixer }, |
| 4695 | .init_verbs = { alc880_volume_init_verbs, |
| 4696 | alc880_pin_tcl_S700_init_verbs, |
| 4697 | alc880_gpio2_init_verbs }, |
| 4698 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4699 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4700 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4701 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4702 | .hp_nid = 0x03, |
| 4703 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4704 | .channel_mode = alc880_2_jack_modes, |
| 4705 | .input_mux = &alc880_capture_source, |
| 4706 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4707 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4708 | .mixers = { alc880_three_stack_mixer, |
| 4709 | alc880_five_stack_mixer}, |
| 4710 | .init_verbs = { alc880_volume_init_verbs, |
| 4711 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4712 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4713 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4714 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4715 | .channel_mode = alc880_fivestack_modes, |
| 4716 | .input_mux = &alc880_capture_source, |
| 4717 | }, |
| 4718 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4719 | .mixers = { alc880_three_stack_mixer, |
| 4720 | alc880_five_stack_mixer }, |
| 4721 | .init_verbs = { alc880_volume_init_verbs, |
| 4722 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4723 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4724 | .dac_nids = alc880_dac_nids, |
| 4725 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4726 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4727 | .channel_mode = alc880_fivestack_modes, |
| 4728 | .input_mux = &alc880_capture_source, |
| 4729 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4730 | [ALC880_6ST] = { |
| 4731 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4732 | .init_verbs = { alc880_volume_init_verbs, |
| 4733 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4734 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4735 | .dac_nids = alc880_6st_dac_nids, |
| 4736 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4737 | .channel_mode = alc880_sixstack_modes, |
| 4738 | .input_mux = &alc880_6stack_capture_source, |
| 4739 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4740 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4741 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4742 | .init_verbs = { alc880_volume_init_verbs, |
| 4743 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4744 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4745 | .dac_nids = alc880_6st_dac_nids, |
| 4746 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4747 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4748 | .channel_mode = alc880_sixstack_modes, |
| 4749 | .input_mux = &alc880_6stack_capture_source, |
| 4750 | }, |
| 4751 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4752 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4753 | .init_verbs = { alc880_volume_init_verbs, |
| 4754 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4755 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4756 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4757 | .dac_nids = alc880_w810_dac_nids, |
| 4758 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4759 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4760 | .channel_mode = alc880_w810_modes, |
| 4761 | .input_mux = &alc880_capture_source, |
| 4762 | }, |
| 4763 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4764 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4765 | .init_verbs = { alc880_volume_init_verbs, |
| 4766 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4767 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4768 | .dac_nids = alc880_z71v_dac_nids, |
| 4769 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4770 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4771 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4772 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4773 | .input_mux = &alc880_capture_source, |
| 4774 | }, |
| 4775 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4776 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4777 | .init_verbs = { alc880_volume_init_verbs, |
| 4778 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4779 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4780 | .dac_nids = alc880_f1734_dac_nids, |
| 4781 | .hp_nid = 0x02, |
| 4782 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4783 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4784 | .input_mux = &alc880_f1734_capture_source, |
| 4785 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4786 | .setup = alc880_uniwill_p53_setup, |
| 4787 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4788 | }, |
| 4789 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4790 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4791 | .init_verbs = { alc880_volume_init_verbs, |
| 4792 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4793 | alc880_gpio1_init_verbs }, |
| 4794 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4795 | .dac_nids = alc880_asus_dac_nids, |
| 4796 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4797 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4798 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4799 | .input_mux = &alc880_capture_source, |
| 4800 | }, |
| 4801 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4802 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4803 | .init_verbs = { alc880_volume_init_verbs, |
| 4804 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4805 | alc880_gpio1_init_verbs }, |
| 4806 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4807 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4808 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4809 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4810 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4811 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4812 | .input_mux = &alc880_capture_source, |
| 4813 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4814 | [ALC880_ASUS_DIG2] = { |
| 4815 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4816 | .init_verbs = { alc880_volume_init_verbs, |
| 4817 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4818 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4819 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4820 | .dac_nids = alc880_asus_dac_nids, |
| 4821 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4822 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4823 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4824 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4825 | .input_mux = &alc880_capture_source, |
| 4826 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4827 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4828 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4829 | .init_verbs = { alc880_volume_init_verbs, |
| 4830 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4831 | alc880_gpio1_init_verbs }, |
| 4832 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4833 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4834 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4835 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4836 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4837 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4838 | .input_mux = &alc880_capture_source, |
| 4839 | }, |
| 4840 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4841 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4842 | .init_verbs = { alc880_volume_init_verbs, |
| 4843 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4844 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4845 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4846 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4847 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4848 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4849 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4850 | .input_mux = &alc880_capture_source, |
| 4851 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4852 | [ALC880_UNIWILL] = { |
| 4853 | .mixers = { alc880_uniwill_mixer }, |
| 4854 | .init_verbs = { alc880_volume_init_verbs, |
| 4855 | alc880_uniwill_init_verbs }, |
| 4856 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4857 | .dac_nids = alc880_asus_dac_nids, |
| 4858 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4859 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4860 | .channel_mode = alc880_threestack_modes, |
| 4861 | .need_dac_fix = 1, |
| 4862 | .input_mux = &alc880_capture_source, |
| 4863 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4864 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4865 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4866 | }, |
| 4867 | [ALC880_UNIWILL_P53] = { |
| 4868 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4869 | .init_verbs = { alc880_volume_init_verbs, |
| 4870 | alc880_uniwill_p53_init_verbs }, |
| 4871 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4872 | .dac_nids = alc880_asus_dac_nids, |
| 4873 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4874 | .channel_mode = alc880_threestack_modes, |
| 4875 | .input_mux = &alc880_capture_source, |
| 4876 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4877 | .setup = alc880_uniwill_p53_setup, |
| 4878 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4879 | }, |
| 4880 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4881 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4882 | .init_verbs = { alc880_volume_init_verbs, |
| 4883 | alc880_uniwill_p53_init_verbs, |
| 4884 | alc880_beep_init_verbs }, |
| 4885 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4886 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4887 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4888 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4889 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4890 | .input_mux = &alc880_capture_source, |
| 4891 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4892 | .setup = alc880_uniwill_p53_setup, |
| 4893 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4894 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4895 | [ALC880_CLEVO] = { |
| 4896 | .mixers = { alc880_three_stack_mixer }, |
| 4897 | .init_verbs = { alc880_volume_init_verbs, |
| 4898 | alc880_pin_clevo_init_verbs }, |
| 4899 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4900 | .dac_nids = alc880_dac_nids, |
| 4901 | .hp_nid = 0x03, |
| 4902 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4903 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4904 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4905 | .input_mux = &alc880_capture_source, |
| 4906 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4907 | [ALC880_LG] = { |
| 4908 | .mixers = { alc880_lg_mixer }, |
| 4909 | .init_verbs = { alc880_volume_init_verbs, |
| 4910 | alc880_lg_init_verbs }, |
| 4911 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4912 | .dac_nids = alc880_lg_dac_nids, |
| 4913 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4914 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4915 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4916 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4917 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4918 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4919 | .setup = alc880_lg_setup, |
| 4920 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4921 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4922 | .loopbacks = alc880_lg_loopbacks, |
| 4923 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4924 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4925 | [ALC880_LG_LW] = { |
| 4926 | .mixers = { alc880_lg_lw_mixer }, |
| 4927 | .init_verbs = { alc880_volume_init_verbs, |
| 4928 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4929 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4930 | .dac_nids = alc880_dac_nids, |
| 4931 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4932 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4933 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4934 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4935 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4936 | .setup = alc880_lg_lw_setup, |
| 4937 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4938 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4939 | [ALC880_MEDION_RIM] = { |
| 4940 | .mixers = { alc880_medion_rim_mixer }, |
| 4941 | .init_verbs = { alc880_volume_init_verbs, |
| 4942 | alc880_medion_rim_init_verbs, |
| 4943 | alc_gpio2_init_verbs }, |
| 4944 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4945 | .dac_nids = alc880_dac_nids, |
| 4946 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4947 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4948 | .channel_mode = alc880_2_jack_modes, |
| 4949 | .input_mux = &alc880_medion_rim_capture_source, |
| 4950 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4951 | .setup = alc880_medion_rim_setup, |
| 4952 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4953 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4954 | #ifdef CONFIG_SND_DEBUG |
| 4955 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4956 | .mixers = { alc880_test_mixer }, |
| 4957 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4958 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4959 | .dac_nids = alc880_test_dac_nids, |
| 4960 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4961 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4962 | .channel_mode = alc880_test_modes, |
| 4963 | .input_mux = &alc880_test_capture_source, |
| 4964 | }, |
| 4965 | #endif |
| 4966 | }; |
| 4967 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4968 | /* |
| 4969 | * Automatic parse of I/O pins from the BIOS configuration |
| 4970 | */ |
| 4971 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4972 | enum { |
| 4973 | ALC_CTL_WIDGET_VOL, |
| 4974 | ALC_CTL_WIDGET_MUTE, |
| 4975 | ALC_CTL_BIND_MUTE, |
| 4976 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4977 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4978 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4979 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4980 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4981 | }; |
| 4982 | |
| 4983 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4984 | static int add_control(struct alc_spec *spec, int type, const char *name, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4985 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4986 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4987 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4988 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4989 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4990 | knew = snd_array_new(&spec->kctls); |
| 4991 | if (!knew) |
| 4992 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4993 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4994 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4995 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4996 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4997 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4998 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4999 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5000 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5001 | return 0; |
| 5002 | } |
| 5003 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5004 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5005 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5006 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5007 | { |
| 5008 | char name[32]; |
| 5009 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5010 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5011 | } |
| 5012 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5013 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5014 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5015 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5016 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5017 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5018 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5019 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5020 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5021 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5022 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5023 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5024 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5025 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5026 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5027 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5028 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5029 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5030 | #define ALC880_PIN_CD_NID 0x1c |
| 5031 | |
| 5032 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5033 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5034 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5035 | { |
| 5036 | hda_nid_t nid; |
| 5037 | int assigned[4]; |
| 5038 | int i, j; |
| 5039 | |
| 5040 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5041 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5042 | |
| 5043 | /* check the pins hardwired to audio widget */ |
| 5044 | for (i = 0; i < cfg->line_outs; i++) { |
| 5045 | nid = cfg->line_out_pins[i]; |
| 5046 | if (alc880_is_fixed_pin(nid)) { |
| 5047 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5048 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5049 | assigned[idx] = 1; |
| 5050 | } |
| 5051 | } |
| 5052 | /* left pins can be connect to any audio widget */ |
| 5053 | for (i = 0; i < cfg->line_outs; i++) { |
| 5054 | nid = cfg->line_out_pins[i]; |
| 5055 | if (alc880_is_fixed_pin(nid)) |
| 5056 | continue; |
| 5057 | /* search for an empty channel */ |
| 5058 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5059 | if (!assigned[j]) { |
| 5060 | spec->multiout.dac_nids[i] = |
| 5061 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5062 | assigned[j] = 1; |
| 5063 | break; |
| 5064 | } |
| 5065 | } |
| 5066 | } |
| 5067 | spec->multiout.num_dacs = cfg->line_outs; |
| 5068 | return 0; |
| 5069 | } |
| 5070 | |
| 5071 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5072 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5073 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5074 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5075 | static const char *chname[4] = { |
| 5076 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5077 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5078 | hda_nid_t nid; |
| 5079 | int i, err; |
| 5080 | |
| 5081 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5082 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5083 | continue; |
| 5084 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 5085 | if (i == 2) { |
| 5086 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5087 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5088 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5089 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5090 | HDA_OUTPUT)); |
| 5091 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5092 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5093 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5094 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5095 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5096 | HDA_OUTPUT)); |
| 5097 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5098 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5099 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5100 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5101 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5102 | HDA_INPUT)); |
| 5103 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5104 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5105 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5106 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5107 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5108 | HDA_INPUT)); |
| 5109 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5110 | return err; |
| 5111 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 5112 | const char *pfx; |
| 5113 | if (cfg->line_outs == 1 && |
| 5114 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 5115 | pfx = "Speaker"; |
| 5116 | else |
| 5117 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5118 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5119 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5120 | HDA_OUTPUT)); |
| 5121 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5122 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5123 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5124 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5125 | HDA_INPUT)); |
| 5126 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5127 | return err; |
| 5128 | } |
| 5129 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5130 | return 0; |
| 5131 | } |
| 5132 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5133 | /* add playback controls for speaker and HP outputs */ |
| 5134 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5135 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5136 | { |
| 5137 | hda_nid_t nid; |
| 5138 | int err; |
| 5139 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5140 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5141 | return 0; |
| 5142 | |
| 5143 | if (alc880_is_fixed_pin(pin)) { |
| 5144 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5145 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5146 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5147 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5148 | else |
| 5149 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5150 | /* control HP volume/switch on the output mixer amp */ |
| 5151 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5152 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5153 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5154 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5155 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5156 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5157 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5158 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5159 | return err; |
| 5160 | } else if (alc880_is_multi_pin(pin)) { |
| 5161 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5162 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5163 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5164 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5165 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5166 | return err; |
| 5167 | } |
| 5168 | return 0; |
| 5169 | } |
| 5170 | |
| 5171 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5172 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5173 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5174 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5175 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5176 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5177 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5178 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5179 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5180 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5181 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5182 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5183 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5184 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5185 | return err; |
| 5186 | return 0; |
| 5187 | } |
| 5188 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5189 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5190 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5191 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5192 | return (pincap & AC_PINCAP_IN) != 0; |
| 5193 | } |
| 5194 | |
| 5195 | /* create playback/capture controls for input pins */ |
| 5196 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5197 | const struct auto_pin_cfg *cfg, |
| 5198 | hda_nid_t mixer, |
| 5199 | hda_nid_t cap1, hda_nid_t cap2) |
| 5200 | { |
| 5201 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5202 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5203 | int i, err, idx, type, type_idx = 0; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5204 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5205 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5206 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5207 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5208 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5209 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5210 | if (!alc_is_input_pin(codec, pin)) |
| 5211 | continue; |
| 5212 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5213 | type = cfg->inputs[i].type; |
| 5214 | if (i > 0 && type == cfg->inputs[i - 1].type) |
| 5215 | type_idx++; |
| 5216 | else |
| 5217 | type_idx = 0; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5218 | label = hda_get_autocfg_input_label(codec, cfg, i); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5219 | if (mixer) { |
| 5220 | idx = get_connection_index(codec, mixer, pin); |
| 5221 | if (idx >= 0) { |
| 5222 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5223 | label, type_idx, |
| 5224 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5225 | if (err < 0) |
| 5226 | return err; |
| 5227 | } |
| 5228 | } |
| 5229 | |
| 5230 | if (!cap1) |
| 5231 | continue; |
| 5232 | idx = get_connection_index(codec, cap1, pin); |
| 5233 | if (idx < 0 && cap2) |
| 5234 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5235 | if (idx >= 0) |
| 5236 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5237 | } |
| 5238 | return 0; |
| 5239 | } |
| 5240 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5241 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5242 | const struct auto_pin_cfg *cfg) |
| 5243 | { |
| 5244 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5245 | } |
| 5246 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5247 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5248 | unsigned int pin_type) |
| 5249 | { |
| 5250 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5251 | pin_type); |
| 5252 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5253 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5254 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5255 | } |
| 5256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5257 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5258 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5259 | int dac_idx) |
| 5260 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5261 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5262 | /* need the manual connection? */ |
| 5263 | if (alc880_is_multi_pin(nid)) { |
| 5264 | struct alc_spec *spec = codec->spec; |
| 5265 | int idx = alc880_multi_pin_idx(nid); |
| 5266 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5267 | AC_VERB_SET_CONNECT_SEL, |
| 5268 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5269 | } |
| 5270 | } |
| 5271 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5272 | static int get_pin_type(int line_out_type) |
| 5273 | { |
| 5274 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5275 | return PIN_HP; |
| 5276 | else |
| 5277 | return PIN_OUT; |
| 5278 | } |
| 5279 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5280 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5281 | { |
| 5282 | struct alc_spec *spec = codec->spec; |
| 5283 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5284 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5285 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5286 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5287 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5288 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5289 | } |
| 5290 | } |
| 5291 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5292 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5293 | { |
| 5294 | struct alc_spec *spec = codec->spec; |
| 5295 | hda_nid_t pin; |
| 5296 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5297 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5298 | if (pin) /* connect to front */ |
| 5299 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5300 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5301 | if (pin) /* connect to front */ |
| 5302 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5303 | } |
| 5304 | |
| 5305 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5306 | { |
| 5307 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5308 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5309 | int i; |
| 5310 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5311 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5312 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5313 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5314 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5315 | if (nid != ALC880_PIN_CD_NID && |
| 5316 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5317 | snd_hda_codec_write(codec, nid, 0, |
| 5318 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5319 | AMP_OUT_MUTE); |
| 5320 | } |
| 5321 | } |
| 5322 | } |
| 5323 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5324 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5325 | { |
| 5326 | struct alc_spec *spec = codec->spec; |
| 5327 | int c; |
| 5328 | |
| 5329 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5330 | unsigned int mux_idx; |
| 5331 | const struct hda_input_mux *imux; |
| 5332 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5333 | imux = &spec->input_mux[mux_idx]; |
| 5334 | if (!imux->num_items && mux_idx > 0) |
| 5335 | imux = &spec->input_mux[0]; |
| 5336 | if (imux) |
| 5337 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5338 | AC_VERB_SET_CONNECT_SEL, |
| 5339 | imux->items[0].index); |
| 5340 | } |
| 5341 | } |
| 5342 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5343 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5344 | /* return 1 if successful, 0 if the proper config is not found, |
| 5345 | * or a negative error code |
| 5346 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5347 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5348 | { |
| 5349 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5350 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5351 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5352 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5353 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5354 | alc880_ignore); |
| 5355 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5356 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5357 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5358 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5359 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5360 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5361 | if (err < 0) |
| 5362 | return err; |
| 5363 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5364 | if (err < 0) |
| 5365 | return err; |
| 5366 | err = alc880_auto_create_extra_out(spec, |
| 5367 | spec->autocfg.speaker_pins[0], |
| 5368 | "Speaker"); |
| 5369 | if (err < 0) |
| 5370 | return err; |
| 5371 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5372 | "Headphone"); |
| 5373 | if (err < 0) |
| 5374 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5375 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5376 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5377 | return err; |
| 5378 | |
| 5379 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5380 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5381 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5382 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5383 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5384 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5385 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5386 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5387 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5388 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5389 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5390 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5391 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5392 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5393 | return 1; |
| 5394 | } |
| 5395 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5396 | /* additional initialization for auto-configuration model */ |
| 5397 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5398 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5399 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5400 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5401 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5402 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5403 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5404 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5405 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5406 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5407 | } |
| 5408 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5409 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5410 | * one of two digital mic pins, e.g. on ALC272 |
| 5411 | */ |
| 5412 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5413 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5414 | struct alc_spec *spec = codec->spec; |
| 5415 | int i; |
| 5416 | |
| 5417 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5418 | hda_nid_t cap = spec->capsrc_nids ? |
| 5419 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5420 | int iidx, eidx; |
| 5421 | |
| 5422 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5423 | if (iidx < 0) |
| 5424 | continue; |
| 5425 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5426 | if (eidx < 0) |
| 5427 | continue; |
| 5428 | spec->int_mic.mux_idx = iidx; |
| 5429 | spec->ext_mic.mux_idx = eidx; |
| 5430 | if (spec->capsrc_nids) |
| 5431 | spec->capsrc_nids += i; |
| 5432 | spec->adc_nids += i; |
| 5433 | spec->num_adc_nids = 1; |
| 5434 | return; |
| 5435 | } |
| 5436 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5437 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5438 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5439 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5440 | } |
| 5441 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5442 | /* select or unmute the given capsrc route */ |
| 5443 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5444 | int idx) |
| 5445 | { |
| 5446 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5447 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5448 | HDA_AMP_MUTE, 0); |
| 5449 | } else { |
| 5450 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5451 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5452 | } |
| 5453 | } |
| 5454 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5455 | /* set the default connection to that pin */ |
| 5456 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5457 | { |
| 5458 | struct alc_spec *spec = codec->spec; |
| 5459 | int i; |
| 5460 | |
| 5461 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5462 | hda_nid_t cap = spec->capsrc_nids ? |
| 5463 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5464 | int idx; |
| 5465 | |
| 5466 | idx = get_connection_index(codec, cap, pin); |
| 5467 | if (idx < 0) |
| 5468 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5469 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5470 | return i; /* return the found index */ |
| 5471 | } |
| 5472 | return -1; /* not found */ |
| 5473 | } |
| 5474 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5475 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5476 | static void fixup_single_adc(struct hda_codec *codec) |
| 5477 | { |
| 5478 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5479 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5480 | int i; |
| 5481 | |
| 5482 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5483 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5484 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5485 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5486 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5487 | /* use only this ADC */ |
| 5488 | if (spec->capsrc_nids) |
| 5489 | spec->capsrc_nids += i; |
| 5490 | spec->adc_nids += i; |
| 5491 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5492 | } |
| 5493 | } |
| 5494 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5495 | /* initialize dual adcs */ |
| 5496 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5497 | { |
| 5498 | struct alc_spec *spec = codec->spec; |
| 5499 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5500 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5501 | } |
| 5502 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5503 | static void set_capture_mixer(struct hda_codec *codec) |
| 5504 | { |
| 5505 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5506 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5507 | { alc_capture_mixer_nosrc1, |
| 5508 | alc_capture_mixer_nosrc2, |
| 5509 | alc_capture_mixer_nosrc3 }, |
| 5510 | { alc_capture_mixer1, |
| 5511 | alc_capture_mixer2, |
| 5512 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5513 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5514 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5515 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5516 | int num_adcs = spec->num_adc_nids; |
| 5517 | if (spec->dual_adc_switch) |
| 5518 | fixup_dual_adc_switch(codec); |
| 5519 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5520 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5521 | else if (spec->input_mux) { |
| 5522 | if (spec->input_mux->num_items > 1) |
| 5523 | mux = 1; |
| 5524 | else if (spec->input_mux->num_items == 1) |
| 5525 | fixup_single_adc(codec); |
| 5526 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5527 | if (spec->dual_adc_switch) |
| 5528 | num_adcs = 1; |
| 5529 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5530 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5531 | } |
| 5532 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5533 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5534 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5535 | int num_nids) |
| 5536 | { |
| 5537 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5538 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5539 | int n; |
| 5540 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5541 | |
| 5542 | for (n = 0; n < num_nids; n++) { |
| 5543 | hda_nid_t adc, cap; |
| 5544 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5545 | int nconns, i, j; |
| 5546 | |
| 5547 | adc = nids[n]; |
| 5548 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5549 | continue; |
| 5550 | cap = adc; |
| 5551 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5552 | ARRAY_SIZE(conn)); |
| 5553 | if (nconns == 1) { |
| 5554 | cap = conn[0]; |
| 5555 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5556 | ARRAY_SIZE(conn)); |
| 5557 | } |
| 5558 | if (nconns <= 0) |
| 5559 | continue; |
| 5560 | if (!fallback_adc) { |
| 5561 | fallback_adc = adc; |
| 5562 | fallback_cap = cap; |
| 5563 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5564 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5565 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5566 | for (j = 0; j < nconns; j++) { |
| 5567 | if (conn[j] == nid) |
| 5568 | break; |
| 5569 | } |
| 5570 | if (j >= nconns) |
| 5571 | break; |
| 5572 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5573 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5574 | int num_adcs = spec->num_adc_nids; |
| 5575 | spec->private_adc_nids[num_adcs] = adc; |
| 5576 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5577 | spec->num_adc_nids++; |
| 5578 | spec->adc_nids = spec->private_adc_nids; |
| 5579 | if (adc != cap) |
| 5580 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5581 | } |
| 5582 | } |
| 5583 | if (!spec->num_adc_nids) { |
| 5584 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5585 | " using fallback 0x%x\n", |
| 5586 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5587 | spec->private_adc_nids[0] = fallback_adc; |
| 5588 | spec->adc_nids = spec->private_adc_nids; |
| 5589 | if (fallback_adc != fallback_cap) { |
| 5590 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5591 | spec->capsrc_nids = spec->private_adc_nids; |
| 5592 | } |
| 5593 | } |
| 5594 | } |
| 5595 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5596 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5597 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5598 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5599 | |
| 5600 | static struct snd_pci_quirk beep_white_list[] = { |
| 5601 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5602 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5603 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5604 | {} |
| 5605 | }; |
| 5606 | |
| 5607 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5608 | { |
| 5609 | struct alc_spec *spec = codec->spec; |
| 5610 | const struct snd_pci_quirk *q; |
| 5611 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5612 | if (q) |
| 5613 | return q->value; |
| 5614 | return spec->cdefine.enable_pcbeep; |
| 5615 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5616 | #else |
| 5617 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5618 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5619 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5620 | |
| 5621 | /* |
| 5622 | * OK, here we have finally the patch for ALC880 |
| 5623 | */ |
| 5624 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5625 | static int patch_alc880(struct hda_codec *codec) |
| 5626 | { |
| 5627 | struct alc_spec *spec; |
| 5628 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5629 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5630 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5631 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5632 | if (spec == NULL) |
| 5633 | return -ENOMEM; |
| 5634 | |
| 5635 | codec->spec = spec; |
| 5636 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5637 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5638 | alc880_models, |
| 5639 | alc880_cfg_tbl); |
| 5640 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5641 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5642 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5643 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5644 | } |
| 5645 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5646 | if (board_config == ALC880_AUTO) { |
| 5647 | /* automatic parse from the BIOS config */ |
| 5648 | err = alc880_parse_auto_config(codec); |
| 5649 | if (err < 0) { |
| 5650 | alc_free(codec); |
| 5651 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5652 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5653 | printk(KERN_INFO |
| 5654 | "hda_codec: Cannot set up configuration " |
| 5655 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5656 | board_config = ALC880_3ST; |
| 5657 | } |
| 5658 | } |
| 5659 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5660 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5661 | if (err < 0) { |
| 5662 | alc_free(codec); |
| 5663 | return err; |
| 5664 | } |
| 5665 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5666 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5667 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5668 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5669 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5670 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5671 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5672 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5673 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5674 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5675 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5676 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5677 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5678 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5679 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5680 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5681 | if (wcap != AC_WID_AUD_IN) { |
| 5682 | spec->adc_nids = alc880_adc_nids_alt; |
| 5683 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5684 | } else { |
| 5685 | spec->adc_nids = alc880_adc_nids; |
| 5686 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5687 | } |
| 5688 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5689 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5690 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5691 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5692 | spec->vmaster_nid = 0x0c; |
| 5693 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5694 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5695 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5696 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5697 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5698 | if (!spec->loopback.amplist) |
| 5699 | spec->loopback.amplist = alc880_loopbacks; |
| 5700 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5701 | |
| 5702 | return 0; |
| 5703 | } |
| 5704 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5705 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5706 | /* |
| 5707 | * ALC260 support |
| 5708 | */ |
| 5709 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5710 | static hda_nid_t alc260_dac_nids[1] = { |
| 5711 | /* front */ |
| 5712 | 0x02, |
| 5713 | }; |
| 5714 | |
| 5715 | static hda_nid_t alc260_adc_nids[1] = { |
| 5716 | /* ADC0 */ |
| 5717 | 0x04, |
| 5718 | }; |
| 5719 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5720 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5721 | /* ADC1 */ |
| 5722 | 0x05, |
| 5723 | }; |
| 5724 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5725 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5726 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5727 | */ |
| 5728 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5729 | /* ADC0, ADC1 */ |
| 5730 | 0x04, 0x05 |
| 5731 | }; |
| 5732 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5733 | #define ALC260_DIGOUT_NID 0x03 |
| 5734 | #define ALC260_DIGIN_NID 0x06 |
| 5735 | |
| 5736 | static struct hda_input_mux alc260_capture_source = { |
| 5737 | .num_items = 4, |
| 5738 | .items = { |
| 5739 | { "Mic", 0x0 }, |
| 5740 | { "Front Mic", 0x1 }, |
| 5741 | { "Line", 0x2 }, |
| 5742 | { "CD", 0x4 }, |
| 5743 | }, |
| 5744 | }; |
| 5745 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5746 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5747 | * headphone jack and the internal CD lines since these are the only pins at |
| 5748 | * which audio can appear. For flexibility, also allow the option of |
| 5749 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5750 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5751 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5752 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5753 | { |
| 5754 | .num_items = 3, |
| 5755 | .items = { |
| 5756 | { "Mic/Line", 0x0 }, |
| 5757 | { "CD", 0x4 }, |
| 5758 | { "Headphone", 0x2 }, |
| 5759 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5760 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5761 | { |
| 5762 | .num_items = 4, |
| 5763 | .items = { |
| 5764 | { "Mic/Line", 0x0 }, |
| 5765 | { "CD", 0x4 }, |
| 5766 | { "Headphone", 0x2 }, |
| 5767 | { "Mixer", 0x5 }, |
| 5768 | }, |
| 5769 | }, |
| 5770 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5771 | }; |
| 5772 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5773 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5774 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5775 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5776 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5777 | { |
| 5778 | .num_items = 4, |
| 5779 | .items = { |
| 5780 | { "Mic", 0x0 }, |
| 5781 | { "Line", 0x2 }, |
| 5782 | { "CD", 0x4 }, |
| 5783 | { "Headphone", 0x5 }, |
| 5784 | }, |
| 5785 | }, |
| 5786 | { |
| 5787 | .num_items = 5, |
| 5788 | .items = { |
| 5789 | { "Mic", 0x0 }, |
| 5790 | { "Line", 0x2 }, |
| 5791 | { "CD", 0x4 }, |
| 5792 | { "Headphone", 0x6 }, |
| 5793 | { "Mixer", 0x5 }, |
| 5794 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5795 | }, |
| 5796 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5797 | |
| 5798 | /* Maxdata Favorit 100XS */ |
| 5799 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5800 | { |
| 5801 | .num_items = 2, |
| 5802 | .items = { |
| 5803 | { "Line/Mic", 0x0 }, |
| 5804 | { "CD", 0x4 }, |
| 5805 | }, |
| 5806 | }, |
| 5807 | { |
| 5808 | .num_items = 3, |
| 5809 | .items = { |
| 5810 | { "Line/Mic", 0x0 }, |
| 5811 | { "CD", 0x4 }, |
| 5812 | { "Mixer", 0x5 }, |
| 5813 | }, |
| 5814 | }, |
| 5815 | }; |
| 5816 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5817 | /* |
| 5818 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5819 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5820 | * element which allows changing the channel mode, so the verb list is |
| 5821 | * never used. |
| 5822 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5823 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5824 | { 2, NULL }, |
| 5825 | }; |
| 5826 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5827 | |
| 5828 | /* Mixer combinations |
| 5829 | * |
| 5830 | * basic: base_output + input + pc_beep + capture |
| 5831 | * HP: base_output + input + capture_alt |
| 5832 | * HP_3013: hp_3013 + input + capture |
| 5833 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5834 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5835 | */ |
| 5836 | |
| 5837 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5838 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5839 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5840 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5841 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5842 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5843 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5844 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5845 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5846 | |
| 5847 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5848 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5849 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5850 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5851 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5854 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5855 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5856 | { } /* end */ |
| 5857 | }; |
| 5858 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5859 | /* update HP, line and mono out pins according to the master switch */ |
| 5860 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5861 | hda_nid_t hp, hda_nid_t line, |
| 5862 | hda_nid_t mono) |
| 5863 | { |
| 5864 | struct alc_spec *spec = codec->spec; |
| 5865 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5866 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5867 | 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] | 5868 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5869 | 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] | 5870 | val); |
| 5871 | /* mono (speaker) depending on the HP jack sense */ |
| 5872 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5873 | 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] | 5874 | val); |
| 5875 | } |
| 5876 | |
| 5877 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5878 | struct snd_ctl_elem_value *ucontrol) |
| 5879 | { |
| 5880 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5881 | struct alc_spec *spec = codec->spec; |
| 5882 | *ucontrol->value.integer.value = spec->master_sw; |
| 5883 | return 0; |
| 5884 | } |
| 5885 | |
| 5886 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5887 | struct snd_ctl_elem_value *ucontrol) |
| 5888 | { |
| 5889 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5890 | struct alc_spec *spec = codec->spec; |
| 5891 | int val = !!*ucontrol->value.integer.value; |
| 5892 | hda_nid_t hp, line, mono; |
| 5893 | |
| 5894 | if (val == spec->master_sw) |
| 5895 | return 0; |
| 5896 | spec->master_sw = val; |
| 5897 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5898 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5899 | mono = kcontrol->private_value & 0xff; |
| 5900 | alc260_hp_master_update(codec, hp, line, mono); |
| 5901 | return 1; |
| 5902 | } |
| 5903 | |
| 5904 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5905 | { |
| 5906 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5907 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5908 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5909 | .info = snd_ctl_boolean_mono_info, |
| 5910 | .get = alc260_hp_master_sw_get, |
| 5911 | .put = alc260_hp_master_sw_put, |
| 5912 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5913 | }, |
| 5914 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5915 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5916 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5917 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5918 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5919 | HDA_OUTPUT), |
| 5920 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5921 | { } /* end */ |
| 5922 | }; |
| 5923 | |
| 5924 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5925 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5926 | {}, |
| 5927 | }; |
| 5928 | |
| 5929 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5930 | { |
| 5931 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5932 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5933 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5934 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5935 | } |
| 5936 | |
| 5937 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5938 | { |
| 5939 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5940 | alc260_hp_automute(codec); |
| 5941 | } |
| 5942 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5943 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5944 | { |
| 5945 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5946 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5947 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5948 | .info = snd_ctl_boolean_mono_info, |
| 5949 | .get = alc260_hp_master_sw_get, |
| 5950 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5951 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5952 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5953 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5954 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5955 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5956 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5957 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5958 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5959 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5960 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5961 | { } /* end */ |
| 5962 | }; |
| 5963 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5964 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5965 | .ops = &snd_hda_bind_vol, |
| 5966 | .values = { |
| 5967 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5968 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5969 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5970 | 0 |
| 5971 | }, |
| 5972 | }; |
| 5973 | |
| 5974 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5975 | .ops = &snd_hda_bind_sw, |
| 5976 | .values = { |
| 5977 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5978 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5979 | 0 |
| 5980 | }, |
| 5981 | }; |
| 5982 | |
| 5983 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5984 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5985 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5986 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5987 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5988 | { } /* end */ |
| 5989 | }; |
| 5990 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5991 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5992 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5993 | {}, |
| 5994 | }; |
| 5995 | |
| 5996 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5997 | { |
| 5998 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5999 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6000 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6001 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6002 | } |
| 6003 | |
| 6004 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 6005 | unsigned int res) |
| 6006 | { |
| 6007 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6008 | alc260_hp_3013_automute(codec); |
| 6009 | } |
| 6010 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6011 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 6012 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6013 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6014 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6015 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6016 | bits); |
| 6017 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6018 | bits); |
| 6019 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6020 | bits); |
| 6021 | } |
| 6022 | |
| 6023 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 6024 | unsigned int res) |
| 6025 | { |
| 6026 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6027 | alc260_hp_3012_automute(codec); |
| 6028 | } |
| 6029 | |
| 6030 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6031 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6032 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6033 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6034 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6035 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6036 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6037 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6038 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6039 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6040 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6041 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6042 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6043 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6044 | { } /* end */ |
| 6045 | }; |
| 6046 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6047 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6048 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6049 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6050 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6051 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6052 | * revisions available in early 2006. Therefore for now allow the |
| 6053 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6054 | * that the lack of mic bias for this NID is intentional we could change the |
| 6055 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6056 | * |
| 6057 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6058 | * don't appear to make the mic bias available from the "line" jack, even |
| 6059 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6060 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6061 | * and the output jack. If this turns out to be the case for all such |
| 6062 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6063 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6064 | * |
| 6065 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6066 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6067 | * controls for such models. On models without a "mono speaker" the control |
| 6068 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6069 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6070 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6071 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6072 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6073 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6074 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6075 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6076 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6077 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6078 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6079 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6080 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6081 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6082 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6083 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6084 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6085 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6086 | { } /* end */ |
| 6087 | }; |
| 6088 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6089 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6090 | */ |
| 6091 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6092 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6093 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6094 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6095 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6096 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6097 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6098 | { } /* end */ |
| 6099 | }; |
| 6100 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6101 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6102 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6103 | */ |
| 6104 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6105 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6106 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6109 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6110 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6111 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6112 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6113 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6114 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6115 | { } /* end */ |
| 6116 | }; |
| 6117 | |
| 6118 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6119 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6120 | */ |
| 6121 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6122 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6123 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6125 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6126 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6127 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6128 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6129 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6130 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6131 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6132 | { } /* end */ |
| 6133 | }; |
| 6134 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6135 | /* |
| 6136 | * initialization verbs |
| 6137 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6138 | static struct hda_verb alc260_init_verbs[] = { |
| 6139 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6140 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6141 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6142 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6143 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6144 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6145 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6146 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6147 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6148 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6149 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6150 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6151 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6152 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6153 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6154 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6155 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6156 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6157 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6158 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6159 | /* set connection select to line in (default select for this ADC) */ |
| 6160 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6161 | /* mute capture amp left and right */ |
| 6162 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6163 | /* set connection select to line in (default select for this ADC) */ |
| 6164 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6165 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6166 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6167 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6168 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6169 | /* set vol=0 HP mixer amp left and right */ |
| 6170 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6171 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6172 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6173 | /* set vol=0 Mono mixer amp left and right */ |
| 6174 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6175 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6176 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6177 | /* unmute LINE-2 out pin */ |
| 6178 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6179 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6180 | * Line In 2 = 0x03 |
| 6181 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6182 | /* mute analog inputs */ |
| 6183 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6184 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6185 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6186 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6187 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6188 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6189 | /* mute Front out path */ |
| 6190 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6192 | /* mute Headphone out path */ |
| 6193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6194 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6195 | /* mute Mono out path */ |
| 6196 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6197 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6198 | { } |
| 6199 | }; |
| 6200 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6201 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6202 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6203 | /* Headphone and output */ |
| 6204 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6205 | /* mono output */ |
| 6206 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6207 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6208 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6209 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6210 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6211 | /* Line In pin widget for input */ |
| 6212 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6213 | /* Line-2 pin widget for output */ |
| 6214 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6215 | /* CD pin widget for input */ |
| 6216 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6217 | /* unmute amp left and right */ |
| 6218 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6219 | /* set connection select to line in (default select for this ADC) */ |
| 6220 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6221 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6222 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6223 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6224 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6225 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6226 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6227 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6228 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6229 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6230 | * Line In 2 = 0x03 |
| 6231 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6232 | /* mute analog inputs */ |
| 6233 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6234 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6235 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6236 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6237 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6238 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6239 | /* Unmute Front out path */ |
| 6240 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6241 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6242 | /* Unmute Headphone out path */ |
| 6243 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6245 | /* Unmute Mono out path */ |
| 6246 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6247 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6248 | { } |
| 6249 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6250 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6251 | |
| 6252 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6253 | /* Line out and output */ |
| 6254 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6255 | /* mono output */ |
| 6256 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6257 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6258 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6259 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6260 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6261 | /* Line In pin widget for input */ |
| 6262 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6263 | /* Headphone pin widget for output */ |
| 6264 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6265 | /* CD pin widget for input */ |
| 6266 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6267 | /* unmute amp left and right */ |
| 6268 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6269 | /* set connection select to line in (default select for this ADC) */ |
| 6270 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6271 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6272 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6273 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6275 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6276 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6277 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6278 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6279 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6280 | * Line In 2 = 0x03 |
| 6281 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6282 | /* mute analog inputs */ |
| 6283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6284 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6285 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6287 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6288 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6289 | /* Unmute Front out path */ |
| 6290 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6291 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6292 | /* Unmute Headphone out path */ |
| 6293 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6295 | /* Unmute Mono out path */ |
| 6296 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6297 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6298 | { } |
| 6299 | }; |
| 6300 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6301 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6302 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6303 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6304 | */ |
| 6305 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6306 | /* Disable all GPIOs */ |
| 6307 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6308 | /* Internal speaker is connected to headphone pin */ |
| 6309 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6310 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6312 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6313 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6314 | /* Ensure all other unused pins are disabled and muted. */ |
| 6315 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6316 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6317 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6318 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6319 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6320 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6321 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6322 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6323 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6324 | /* Disable digital (SPDIF) pins */ |
| 6325 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6326 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6327 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6328 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6329 | * when acting as an output. |
| 6330 | */ |
| 6331 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6332 | |
| 6333 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6334 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6335 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6336 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6337 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6338 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6339 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6340 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6341 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6342 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6343 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6344 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6345 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6346 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6347 | * If the pin mode is changed by the user the pin mode control will |
| 6348 | * take care of enabling the pin's input/output buffers as needed. |
| 6349 | * Therefore there's no need to enable the input buffer at this |
| 6350 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6351 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6352 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6353 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6354 | * mixer ctrl) |
| 6355 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6356 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6357 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6358 | /* Mute capture amp left and right */ |
| 6359 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6360 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6361 | * in (on mic1 pin) |
| 6362 | */ |
| 6363 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6364 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6365 | /* Do the same for the second ADC: mute capture input amp and |
| 6366 | * set ADC connection to line in (on mic1 pin) |
| 6367 | */ |
| 6368 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6369 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6370 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6371 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6373 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6374 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6375 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6376 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6377 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6378 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6379 | {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] | 6380 | |
| 6381 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6382 | }; |
| 6383 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6384 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6385 | * similar laptops (adapted from Fujitsu init verbs). |
| 6386 | */ |
| 6387 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6388 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6389 | * the headphone jack. Turn this on and rely on the standard mute |
| 6390 | * methods whenever the user wants to turn these outputs off. |
| 6391 | */ |
| 6392 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6393 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6394 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6395 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6396 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6397 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6398 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6399 | /* Line In jack is connected to Line1 pin */ |
| 6400 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6401 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6402 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6403 | /* Ensure all other unused pins are disabled and muted. */ |
| 6404 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6405 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6406 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6407 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6408 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6409 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6410 | /* Disable digital (SPDIF) pins */ |
| 6411 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6412 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6413 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6414 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6415 | * bus when acting as outputs. |
| 6416 | */ |
| 6417 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6418 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6419 | |
| 6420 | /* Start with output sum widgets muted and their output gains at min */ |
| 6421 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6422 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6423 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6424 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6426 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6427 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6428 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6429 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6430 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6431 | /* Unmute Line-out pin widget amp left and right |
| 6432 | * (no equiv mixer ctrl) |
| 6433 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6434 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6435 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6436 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6437 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6438 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6439 | * will take care of enabling the pin's input/output buffers as needed. |
| 6440 | * Therefore there's no need to enable the input buffer at this |
| 6441 | * stage. |
| 6442 | */ |
| 6443 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6444 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6445 | |
| 6446 | /* Mute capture amp left and right */ |
| 6447 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6448 | /* Set ADC connection select to match default mixer setting - mic |
| 6449 | * (on mic1 pin) |
| 6450 | */ |
| 6451 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6452 | |
| 6453 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6454 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6455 | */ |
| 6456 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6457 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6458 | |
| 6459 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6462 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6463 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6464 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6465 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6466 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6467 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6468 | |
| 6469 | { } |
| 6470 | }; |
| 6471 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6472 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6473 | * (adapted from Acer init verbs). |
| 6474 | */ |
| 6475 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6476 | /* GPIO 0 enables the output jack. |
| 6477 | * Turn this on and rely on the standard mute |
| 6478 | * methods whenever the user wants to turn these outputs off. |
| 6479 | */ |
| 6480 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6481 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6482 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6483 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6484 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6485 | /* Ensure all other unused pins are disabled and muted. */ |
| 6486 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6487 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6488 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6489 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6490 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6491 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6492 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6493 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6494 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6495 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6496 | /* Disable digital (SPDIF) pins */ |
| 6497 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6498 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6499 | |
| 6500 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6501 | * bus when acting as outputs. |
| 6502 | */ |
| 6503 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6504 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6505 | |
| 6506 | /* Start with output sum widgets muted and their output gains at min */ |
| 6507 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6508 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6509 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6510 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6511 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6512 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6513 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6514 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6515 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6516 | |
| 6517 | /* Unmute Line-out pin widget amp left and right |
| 6518 | * (no equiv mixer ctrl) |
| 6519 | */ |
| 6520 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6521 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6522 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6523 | * will take care of enabling the pin's input/output buffers as needed. |
| 6524 | * Therefore there's no need to enable the input buffer at this |
| 6525 | * stage. |
| 6526 | */ |
| 6527 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6528 | |
| 6529 | /* Mute capture amp left and right */ |
| 6530 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6531 | /* Set ADC connection select to match default mixer setting - mic |
| 6532 | * (on mic1 pin) |
| 6533 | */ |
| 6534 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6535 | |
| 6536 | /* Do similar with the second ADC: mute capture input amp and |
| 6537 | * set ADC connection to mic to match ALSA's default state. |
| 6538 | */ |
| 6539 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6540 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6541 | |
| 6542 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6544 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6545 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6551 | |
| 6552 | { } |
| 6553 | }; |
| 6554 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6555 | static struct hda_verb alc260_will_verbs[] = { |
| 6556 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6557 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6558 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6559 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6560 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6561 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6562 | {} |
| 6563 | }; |
| 6564 | |
| 6565 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6566 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6567 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6568 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6569 | |
| 6570 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6571 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6572 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6573 | |
| 6574 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6575 | {} |
| 6576 | }; |
| 6577 | |
| 6578 | /* toggle speaker-output according to the hp-jack state */ |
| 6579 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6580 | { |
| 6581 | unsigned int present; |
| 6582 | |
| 6583 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6584 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6585 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6586 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6587 | AC_VERB_SET_GPIO_DATA, 1); |
| 6588 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6589 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6590 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6591 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6592 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6593 | AC_VERB_SET_GPIO_DATA, 0); |
| 6594 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6595 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6596 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6597 | } |
| 6598 | } |
| 6599 | |
| 6600 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6601 | unsigned int res) |
| 6602 | { |
| 6603 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6604 | alc260_replacer_672v_automute(codec); |
| 6605 | } |
| 6606 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6607 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6608 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6609 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6610 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6611 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6612 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6613 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6614 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6615 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6616 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6617 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6618 | {} |
| 6619 | }; |
| 6620 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6621 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6622 | * configuration. |
| 6623 | */ |
| 6624 | #ifdef CONFIG_SND_DEBUG |
| 6625 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6626 | 0x02, |
| 6627 | }; |
| 6628 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6629 | 0x04, 0x05, |
| 6630 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6631 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6632 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6633 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6634 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6635 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6636 | { |
| 6637 | .num_items = 7, |
| 6638 | .items = { |
| 6639 | { "MIC1 pin", 0x0 }, |
| 6640 | { "MIC2 pin", 0x1 }, |
| 6641 | { "LINE1 pin", 0x2 }, |
| 6642 | { "LINE2 pin", 0x3 }, |
| 6643 | { "CD pin", 0x4 }, |
| 6644 | { "LINE-OUT pin", 0x5 }, |
| 6645 | { "HP-OUT pin", 0x6 }, |
| 6646 | }, |
| 6647 | }, |
| 6648 | { |
| 6649 | .num_items = 8, |
| 6650 | .items = { |
| 6651 | { "MIC1 pin", 0x0 }, |
| 6652 | { "MIC2 pin", 0x1 }, |
| 6653 | { "LINE1 pin", 0x2 }, |
| 6654 | { "LINE2 pin", 0x3 }, |
| 6655 | { "CD pin", 0x4 }, |
| 6656 | { "Mixer", 0x5 }, |
| 6657 | { "LINE-OUT pin", 0x6 }, |
| 6658 | { "HP-OUT pin", 0x7 }, |
| 6659 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6660 | }, |
| 6661 | }; |
| 6662 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6663 | /* Output driver widgets */ |
| 6664 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6665 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6666 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6667 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6668 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6669 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6670 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6671 | /* Modes for retasking pin widgets |
| 6672 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6673 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6674 | * mention this restriction. At this stage it's not clear whether |
| 6675 | * this behaviour is intentional or is a hardware bug in chip |
| 6676 | * revisions available at least up until early 2006. Therefore for |
| 6677 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6678 | * choices, but if it turns out that the lack of mic bias for these |
| 6679 | * NIDs is intentional we could change their modes from |
| 6680 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6681 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6682 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6683 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6684 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6685 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6686 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6687 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6688 | |
| 6689 | /* Loopback mixer controls */ |
| 6690 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6691 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6692 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6693 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6694 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6695 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6696 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6697 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6698 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6699 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6700 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6701 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6702 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6703 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6704 | |
| 6705 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6706 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6707 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6708 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6709 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6710 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6711 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6712 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6713 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6714 | */ |
| 6715 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6716 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6717 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6718 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6719 | * this output to turn on an external amplifier. |
| 6720 | */ |
| 6721 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6722 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6723 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6724 | { } /* end */ |
| 6725 | }; |
| 6726 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6727 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6728 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6729 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6730 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6731 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6732 | /* Enable retasking pins as output, initially without power amp */ |
| 6733 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6734 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6735 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6736 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6737 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6738 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6739 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6740 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6741 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6742 | * payload also sets the generation to 0, output to be in "consumer" |
| 6743 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6744 | * control. |
| 6745 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6746 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6747 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6748 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6749 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6750 | * OUT1 sum bus when acting as an output. |
| 6751 | */ |
| 6752 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6753 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6754 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6755 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6756 | |
| 6757 | /* Start with output sum widgets muted and their output gains at min */ |
| 6758 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6759 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6760 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6761 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6762 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6763 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6764 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6765 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6766 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6767 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6768 | /* Unmute retasking pin widget output buffers since the default |
| 6769 | * state appears to be output. As the pin mode is changed by the |
| 6770 | * user the pin mode control will take care of enabling the pin's |
| 6771 | * input/output buffers as needed. |
| 6772 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6773 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6774 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6776 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6777 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6778 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6779 | /* Also unmute the mono-out pin widget */ |
| 6780 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6781 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6782 | /* Mute capture amp left and right */ |
| 6783 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6784 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6785 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6786 | */ |
| 6787 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6788 | |
| 6789 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6790 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6791 | */ |
| 6792 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6793 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6794 | |
| 6795 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6796 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6797 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6798 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6799 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6800 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6801 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6802 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6803 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6804 | |
| 6805 | { } |
| 6806 | }; |
| 6807 | #endif |
| 6808 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6809 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6810 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6811 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6812 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6813 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6814 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6815 | /* |
| 6816 | * for BIOS auto-configuration |
| 6817 | */ |
| 6818 | |
| 6819 | 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] | 6820 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6821 | { |
| 6822 | hda_nid_t nid_vol; |
| 6823 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6824 | int err; |
| 6825 | |
| 6826 | if (nid >= 0x0f && nid < 0x11) { |
| 6827 | nid_vol = nid - 0x7; |
| 6828 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6829 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6830 | } else if (nid == 0x11) { |
| 6831 | nid_vol = nid - 0x7; |
| 6832 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6833 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6834 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6835 | nid_vol = 0x08; |
| 6836 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6837 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6838 | } else |
| 6839 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6840 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6841 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6842 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6843 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6844 | if (err < 0) |
| 6845 | return err; |
| 6846 | *vol_bits |= (1 << nid_vol); |
| 6847 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6848 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6849 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6850 | return err; |
| 6851 | return 1; |
| 6852 | } |
| 6853 | |
| 6854 | /* add playback controls from the parsed DAC table */ |
| 6855 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6856 | const struct auto_pin_cfg *cfg) |
| 6857 | { |
| 6858 | hda_nid_t nid; |
| 6859 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6860 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6861 | |
| 6862 | spec->multiout.num_dacs = 1; |
| 6863 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6864 | spec->multiout.dac_nids[0] = 0x02; |
| 6865 | |
| 6866 | nid = cfg->line_out_pins[0]; |
| 6867 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6868 | const char *pfx; |
| 6869 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6870 | pfx = "Master"; |
| 6871 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6872 | pfx = "Speaker"; |
| 6873 | else |
| 6874 | pfx = "Front"; |
| 6875 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6876 | if (err < 0) |
| 6877 | return err; |
| 6878 | } |
| 6879 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6880 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6881 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6882 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6883 | if (err < 0) |
| 6884 | return err; |
| 6885 | } |
| 6886 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6887 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6888 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6889 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6890 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6891 | if (err < 0) |
| 6892 | return err; |
| 6893 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6894 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6895 | } |
| 6896 | |
| 6897 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6898 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6899 | const struct auto_pin_cfg *cfg) |
| 6900 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6901 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6902 | } |
| 6903 | |
| 6904 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6905 | hda_nid_t nid, int pin_type, |
| 6906 | int sel_idx) |
| 6907 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6908 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6909 | /* need the manual connection? */ |
| 6910 | if (nid >= 0x12) { |
| 6911 | int idx = nid - 0x12; |
| 6912 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6913 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6914 | } |
| 6915 | } |
| 6916 | |
| 6917 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6918 | { |
| 6919 | struct alc_spec *spec = codec->spec; |
| 6920 | hda_nid_t nid; |
| 6921 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6922 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6923 | if (nid) { |
| 6924 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6925 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6926 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6927 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6928 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6929 | if (nid) |
| 6930 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6931 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6932 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6933 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6934 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6935 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6936 | |
| 6937 | #define ALC260_PIN_CD_NID 0x16 |
| 6938 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6939 | { |
| 6940 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6941 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6942 | int i; |
| 6943 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6944 | for (i = 0; i < cfg->num_inputs; i++) { |
| 6945 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6946 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 6947 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6948 | if (nid != ALC260_PIN_CD_NID && |
| 6949 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6950 | snd_hda_codec_write(codec, nid, 0, |
| 6951 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6952 | AMP_OUT_MUTE); |
| 6953 | } |
| 6954 | } |
| 6955 | } |
| 6956 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6957 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6958 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6959 | /* |
| 6960 | * generic initialization of ADC, input mixers and output mixers |
| 6961 | */ |
| 6962 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6963 | /* |
| 6964 | * Unmute ADC0-1 and set the default input to mic-in |
| 6965 | */ |
| 6966 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6967 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6968 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6969 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6970 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6971 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6972 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6973 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6974 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6975 | */ |
| 6976 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6977 | /* mute analog inputs */ |
| 6978 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6980 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6981 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6982 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6983 | |
| 6984 | /* |
| 6985 | * Set up output mixers (0x08 - 0x0a) |
| 6986 | */ |
| 6987 | /* set vol=0 to output mixers */ |
| 6988 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6989 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6990 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6991 | /* set up input amps for analog loopback */ |
| 6992 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6993 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6994 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6995 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6996 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6997 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6998 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6999 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7000 | { } |
| 7001 | }; |
| 7002 | |
| 7003 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7004 | { |
| 7005 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7006 | int err; |
| 7007 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7008 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7009 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7010 | alc260_ignore); |
| 7011 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7012 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7013 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7014 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7015 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7016 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7017 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7018 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7019 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7020 | return err; |
| 7021 | |
| 7022 | spec->multiout.max_channels = 2; |
| 7023 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7024 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7025 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7026 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7027 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7028 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7029 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7030 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7031 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7032 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7033 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7034 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7035 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7036 | return 1; |
| 7037 | } |
| 7038 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7039 | /* additional initialization for auto-configuration model */ |
| 7040 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7041 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7042 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7043 | alc260_auto_init_multi_out(codec); |
| 7044 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7045 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7046 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7047 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7048 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7049 | } |
| 7050 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7051 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7052 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7053 | { 0x07, HDA_INPUT, 0 }, |
| 7054 | { 0x07, HDA_INPUT, 1 }, |
| 7055 | { 0x07, HDA_INPUT, 2 }, |
| 7056 | { 0x07, HDA_INPUT, 3 }, |
| 7057 | { 0x07, HDA_INPUT, 4 }, |
| 7058 | { } /* end */ |
| 7059 | }; |
| 7060 | #endif |
| 7061 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7062 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7063 | * Pin config fixes |
| 7064 | */ |
| 7065 | enum { |
| 7066 | PINFIX_HP_DC5750, |
| 7067 | }; |
| 7068 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7069 | static const struct alc_fixup alc260_fixups[] = { |
| 7070 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7071 | .pins = (const struct alc_pincfg[]) { |
| 7072 | { 0x11, 0x90130110 }, /* speaker */ |
| 7073 | { } |
| 7074 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7075 | }, |
| 7076 | }; |
| 7077 | |
| 7078 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7079 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7080 | {} |
| 7081 | }; |
| 7082 | |
| 7083 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7084 | * ALC260 configurations |
| 7085 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7086 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 7087 | [ALC260_BASIC] = "basic", |
| 7088 | [ALC260_HP] = "hp", |
| 7089 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7090 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7091 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7092 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7093 | [ALC260_WILL] = "will", |
| 7094 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7095 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7096 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7097 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7098 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7099 | [ALC260_AUTO] = "auto", |
| 7100 | }; |
| 7101 | |
| 7102 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7103 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7104 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7105 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7106 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7107 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7108 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7109 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7110 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7111 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7112 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7113 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7114 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7115 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7116 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7117 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7118 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7119 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7120 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7121 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7122 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7123 | {} |
| 7124 | }; |
| 7125 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7126 | static struct alc_config_preset alc260_presets[] = { |
| 7127 | [ALC260_BASIC] = { |
| 7128 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7129 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7130 | .init_verbs = { alc260_init_verbs }, |
| 7131 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7132 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7133 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7134 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7135 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7136 | .channel_mode = alc260_modes, |
| 7137 | .input_mux = &alc260_capture_source, |
| 7138 | }, |
| 7139 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7140 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7141 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7142 | .init_verbs = { alc260_init_verbs, |
| 7143 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7144 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7145 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7146 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7147 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7148 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7149 | .channel_mode = alc260_modes, |
| 7150 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7151 | .unsol_event = alc260_hp_unsol_event, |
| 7152 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7153 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7154 | [ALC260_HP_DC7600] = { |
| 7155 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7156 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7157 | .init_verbs = { alc260_init_verbs, |
| 7158 | alc260_hp_dc7600_verbs }, |
| 7159 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7160 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7161 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7162 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7163 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7164 | .channel_mode = alc260_modes, |
| 7165 | .input_mux = &alc260_capture_source, |
| 7166 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7167 | .init_hook = alc260_hp_3012_automute, |
| 7168 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7169 | [ALC260_HP_3013] = { |
| 7170 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7171 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7172 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7173 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7174 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7175 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7176 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7177 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7178 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7179 | .channel_mode = alc260_modes, |
| 7180 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7181 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7182 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7183 | }, |
| 7184 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7185 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7186 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7187 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7188 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7189 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7190 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7191 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7192 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7193 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7194 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7195 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7196 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7197 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7198 | .init_verbs = { alc260_acer_init_verbs }, |
| 7199 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7200 | .dac_nids = alc260_dac_nids, |
| 7201 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7202 | .adc_nids = alc260_dual_adc_nids, |
| 7203 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7204 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7205 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7206 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7207 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7208 | [ALC260_FAVORIT100] = { |
| 7209 | .mixers = { alc260_favorit100_mixer }, |
| 7210 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7211 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7212 | .dac_nids = alc260_dac_nids, |
| 7213 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7214 | .adc_nids = alc260_dual_adc_nids, |
| 7215 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7216 | .channel_mode = alc260_modes, |
| 7217 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7218 | .input_mux = alc260_favorit100_capture_sources, |
| 7219 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7220 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7221 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7222 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7223 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7224 | .dac_nids = alc260_dac_nids, |
| 7225 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7226 | .adc_nids = alc260_adc_nids, |
| 7227 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7228 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7229 | .channel_mode = alc260_modes, |
| 7230 | .input_mux = &alc260_capture_source, |
| 7231 | }, |
| 7232 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7233 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7234 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7235 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7236 | .dac_nids = alc260_dac_nids, |
| 7237 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7238 | .adc_nids = alc260_adc_nids, |
| 7239 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7240 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7241 | .channel_mode = alc260_modes, |
| 7242 | .input_mux = &alc260_capture_source, |
| 7243 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7244 | .init_hook = alc260_replacer_672v_automute, |
| 7245 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7246 | #ifdef CONFIG_SND_DEBUG |
| 7247 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7248 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7249 | .init_verbs = { alc260_test_init_verbs }, |
| 7250 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7251 | .dac_nids = alc260_test_dac_nids, |
| 7252 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7253 | .adc_nids = alc260_test_adc_nids, |
| 7254 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7255 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7256 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7257 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7258 | }, |
| 7259 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7260 | }; |
| 7261 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7262 | static int patch_alc260(struct hda_codec *codec) |
| 7263 | { |
| 7264 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7265 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7266 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7267 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7268 | if (spec == NULL) |
| 7269 | return -ENOMEM; |
| 7270 | |
| 7271 | codec->spec = spec; |
| 7272 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7273 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7274 | alc260_models, |
| 7275 | alc260_cfg_tbl); |
| 7276 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7277 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7278 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7279 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7280 | } |
| 7281 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7282 | if (board_config == ALC260_AUTO) |
| 7283 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); |
| 7284 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7285 | if (board_config == ALC260_AUTO) { |
| 7286 | /* automatic parse from the BIOS config */ |
| 7287 | err = alc260_parse_auto_config(codec); |
| 7288 | if (err < 0) { |
| 7289 | alc_free(codec); |
| 7290 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7291 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7292 | printk(KERN_INFO |
| 7293 | "hda_codec: Cannot set up configuration " |
| 7294 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7295 | board_config = ALC260_BASIC; |
| 7296 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7297 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7298 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7299 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7300 | if (err < 0) { |
| 7301 | alc_free(codec); |
| 7302 | return err; |
| 7303 | } |
| 7304 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7305 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7306 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7307 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7308 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7309 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7310 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7311 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7312 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7313 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7314 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7315 | if (!spec->adc_nids && spec->input_mux) { |
| 7316 | /* check whether NID 0x04 is valid */ |
| 7317 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7318 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7319 | /* get type */ |
| 7320 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7321 | spec->adc_nids = alc260_adc_nids_alt; |
| 7322 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7323 | } else { |
| 7324 | spec->adc_nids = alc260_adc_nids; |
| 7325 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7326 | } |
| 7327 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7328 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7329 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7330 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7331 | if (board_config == ALC260_AUTO) |
| 7332 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); |
| 7333 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7334 | spec->vmaster_nid = 0x08; |
| 7335 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7336 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7337 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7338 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7339 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7340 | if (!spec->loopback.amplist) |
| 7341 | spec->loopback.amplist = alc260_loopbacks; |
| 7342 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7343 | |
| 7344 | return 0; |
| 7345 | } |
| 7346 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7347 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7348 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7349 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7350 | * |
| 7351 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7352 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7353 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7354 | * 6-channel independent captures. |
| 7355 | * |
| 7356 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7357 | * driver yet). |
| 7358 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7359 | #define ALC882_DIGOUT_NID 0x06 |
| 7360 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7361 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7362 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7363 | #define ALC1200_DIGOUT_NID 0x10 |
| 7364 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7365 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7366 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7367 | { 8, NULL } |
| 7368 | }; |
| 7369 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7370 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7371 | static hda_nid_t alc882_dac_nids[4] = { |
| 7372 | /* front, rear, clfe, rear_surr */ |
| 7373 | 0x02, 0x03, 0x04, 0x05 |
| 7374 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7375 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7376 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7377 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7378 | #define alc882_adc_nids alc880_adc_nids |
| 7379 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7380 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7381 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7382 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7383 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7384 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7385 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7386 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7387 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7388 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7389 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7390 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7391 | /* input MUX */ |
| 7392 | /* FIXME: should be a matrix-type input source selection */ |
| 7393 | |
| 7394 | static struct hda_input_mux alc882_capture_source = { |
| 7395 | .num_items = 4, |
| 7396 | .items = { |
| 7397 | { "Mic", 0x0 }, |
| 7398 | { "Front Mic", 0x1 }, |
| 7399 | { "Line", 0x2 }, |
| 7400 | { "CD", 0x4 }, |
| 7401 | }, |
| 7402 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7403 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7404 | #define alc883_capture_source alc882_capture_source |
| 7405 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7406 | static struct hda_input_mux alc889_capture_source = { |
| 7407 | .num_items = 3, |
| 7408 | .items = { |
| 7409 | { "Front Mic", 0x0 }, |
| 7410 | { "Mic", 0x3 }, |
| 7411 | { "Line", 0x2 }, |
| 7412 | }, |
| 7413 | }; |
| 7414 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7415 | static struct hda_input_mux mb5_capture_source = { |
| 7416 | .num_items = 3, |
| 7417 | .items = { |
| 7418 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7419 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7420 | { "CD", 0x4 }, |
| 7421 | }, |
| 7422 | }; |
| 7423 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7424 | static struct hda_input_mux macmini3_capture_source = { |
| 7425 | .num_items = 2, |
| 7426 | .items = { |
| 7427 | { "Line", 0x2 }, |
| 7428 | { "CD", 0x4 }, |
| 7429 | }, |
| 7430 | }; |
| 7431 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7432 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7433 | .num_items = 4, |
| 7434 | .items = { |
| 7435 | { "Mic", 0x1 }, |
| 7436 | { "Front Mic", 0x0 }, |
| 7437 | { "Line", 0x2 }, |
| 7438 | { "CD", 0x4 }, |
| 7439 | }, |
| 7440 | }; |
| 7441 | |
| 7442 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7443 | .num_items = 2, |
| 7444 | .items = { |
| 7445 | { "Mic", 0x1 }, |
| 7446 | { "Line", 0x2 }, |
| 7447 | }, |
| 7448 | }; |
| 7449 | |
| 7450 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7451 | .num_items = 4, |
| 7452 | .items = { |
| 7453 | { "Mic", 0x0 }, |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 7454 | { "Int Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7455 | { "Line", 0x2 }, |
| 7456 | { "CD", 0x4 }, |
| 7457 | }, |
| 7458 | }; |
| 7459 | |
| 7460 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7461 | .num_items = 2, |
| 7462 | .items = { |
| 7463 | { "Mic", 0x0 }, |
| 7464 | { "Int Mic", 0x1 }, |
| 7465 | }, |
| 7466 | }; |
| 7467 | |
| 7468 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7469 | .num_items = 3, |
| 7470 | .items = { |
| 7471 | { "Mic", 0x0 }, |
| 7472 | { "Front Mic", 0x1 }, |
| 7473 | { "Line", 0x4 }, |
| 7474 | }, |
| 7475 | }; |
| 7476 | |
| 7477 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7478 | .num_items = 2, |
| 7479 | .items = { |
| 7480 | { "Mic", 0x0 }, |
| 7481 | { "Line", 0x2 }, |
| 7482 | }, |
| 7483 | }; |
| 7484 | |
| 7485 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7486 | .num_items = 2, |
| 7487 | .items = { |
| 7488 | { "Mic", 0x0 }, |
| 7489 | /* Front Mic (0x01) unused */ |
| 7490 | { "Line", 0x2 }, |
| 7491 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7492 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7493 | }, |
| 7494 | }; |
| 7495 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7496 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7497 | .num_items = 2, |
| 7498 | .items = { |
| 7499 | { "Mic", 0x01 }, |
| 7500 | { "Line", 0x2 }, /* Not sure! */ |
| 7501 | }, |
| 7502 | }; |
| 7503 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7504 | /* |
| 7505 | * 2ch mode |
| 7506 | */ |
| 7507 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7508 | { 2, NULL } |
| 7509 | }; |
| 7510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7511 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7512 | * 2ch mode |
| 7513 | */ |
| 7514 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7515 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7516 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7517 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7518 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7519 | { } /* end */ |
| 7520 | }; |
| 7521 | |
| 7522 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7523 | * 4ch mode |
| 7524 | */ |
| 7525 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7526 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7527 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7528 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7529 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7530 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7531 | { } /* end */ |
| 7532 | }; |
| 7533 | |
| 7534 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7535 | * 6ch mode |
| 7536 | */ |
| 7537 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7538 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7539 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7540 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7541 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7542 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7543 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7544 | { } /* end */ |
| 7545 | }; |
| 7546 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7547 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7548 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7549 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7550 | { 6, alc882_3ST_ch6_init }, |
| 7551 | }; |
| 7552 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7553 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7554 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7555 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7556 | * 2ch mode |
| 7557 | */ |
| 7558 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7559 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7560 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7561 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7562 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7563 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7564 | { } /* end */ |
| 7565 | }; |
| 7566 | |
| 7567 | /* |
| 7568 | * 4ch mode |
| 7569 | */ |
| 7570 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7571 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7572 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7573 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7574 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7575 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7576 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7577 | { } /* end */ |
| 7578 | }; |
| 7579 | |
| 7580 | /* |
| 7581 | * 6ch mode |
| 7582 | */ |
| 7583 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7584 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7585 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7586 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7587 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7588 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7589 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7590 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7591 | { } /* end */ |
| 7592 | }; |
| 7593 | |
| 7594 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7595 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7596 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7597 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7598 | }; |
| 7599 | |
| 7600 | |
| 7601 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7602 | * 6ch mode |
| 7603 | */ |
| 7604 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7605 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7606 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7607 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7608 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7609 | { } /* end */ |
| 7610 | }; |
| 7611 | |
| 7612 | /* |
| 7613 | * 8ch mode |
| 7614 | */ |
| 7615 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7616 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7617 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7618 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7619 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7620 | { } /* end */ |
| 7621 | }; |
| 7622 | |
| 7623 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7624 | { 6, alc882_sixstack_ch6_init }, |
| 7625 | { 8, alc882_sixstack_ch8_init }, |
| 7626 | }; |
| 7627 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7628 | |
| 7629 | /* Macbook Air 2,1 */ |
| 7630 | |
| 7631 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7632 | { 2, NULL }, |
| 7633 | }; |
| 7634 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7635 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7636 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7637 | */ |
| 7638 | |
| 7639 | /* |
| 7640 | * 2ch mode |
| 7641 | */ |
| 7642 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7643 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7644 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7645 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7646 | { } /* end */ |
| 7647 | }; |
| 7648 | |
| 7649 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7650 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7651 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7652 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7653 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7654 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7655 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7656 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7657 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7658 | { } /* end */ |
| 7659 | }; |
| 7660 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7661 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7662 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7663 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7664 | }; |
| 7665 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7666 | /* |
| 7667 | * 2ch |
| 7668 | * Speakers/Woofer/HP = Front |
| 7669 | * LineIn = Input |
| 7670 | */ |
| 7671 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7672 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7673 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7674 | { } /* end */ |
| 7675 | }; |
| 7676 | |
| 7677 | /* |
| 7678 | * 6ch mode |
| 7679 | * Speakers/HP = Front |
| 7680 | * Woofer = LFE |
| 7681 | * LineIn = Surround |
| 7682 | */ |
| 7683 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7684 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7685 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7686 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7687 | { } /* end */ |
| 7688 | }; |
| 7689 | |
| 7690 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7691 | { 2, alc885_mb5_ch2_init }, |
| 7692 | { 6, alc885_mb5_ch6_init }, |
| 7693 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7694 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7695 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7696 | |
| 7697 | /* |
| 7698 | * 2ch mode |
| 7699 | */ |
| 7700 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7701 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7702 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7703 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7704 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7705 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7706 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7707 | { } /* end */ |
| 7708 | }; |
| 7709 | |
| 7710 | /* |
| 7711 | * 4ch mode |
| 7712 | */ |
| 7713 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7714 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7715 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7716 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7717 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7718 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7719 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7720 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7721 | { } /* end */ |
| 7722 | }; |
| 7723 | |
| 7724 | /* |
| 7725 | * 6ch mode |
| 7726 | */ |
| 7727 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7728 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7729 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7730 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7731 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7732 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7733 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7734 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7735 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7736 | { } /* end */ |
| 7737 | }; |
| 7738 | |
| 7739 | /* |
| 7740 | * 8ch mode |
| 7741 | */ |
| 7742 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7743 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7744 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7745 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7746 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7747 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7748 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7749 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7750 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7751 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7752 | { } /* end */ |
| 7753 | }; |
| 7754 | |
| 7755 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7756 | { 2, alc883_4ST_ch2_init }, |
| 7757 | { 4, alc883_4ST_ch4_init }, |
| 7758 | { 6, alc883_4ST_ch6_init }, |
| 7759 | { 8, alc883_4ST_ch8_init }, |
| 7760 | }; |
| 7761 | |
| 7762 | |
| 7763 | /* |
| 7764 | * 2ch mode |
| 7765 | */ |
| 7766 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7767 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7768 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7769 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7770 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7771 | { } /* end */ |
| 7772 | }; |
| 7773 | |
| 7774 | /* |
| 7775 | * 4ch mode |
| 7776 | */ |
| 7777 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7778 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7779 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7780 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7781 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7782 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7783 | { } /* end */ |
| 7784 | }; |
| 7785 | |
| 7786 | /* |
| 7787 | * 6ch mode |
| 7788 | */ |
| 7789 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7790 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7791 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7792 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7793 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7794 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7795 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7796 | { } /* end */ |
| 7797 | }; |
| 7798 | |
| 7799 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7800 | { 2, alc883_3ST_ch2_intel_init }, |
| 7801 | { 4, alc883_3ST_ch4_intel_init }, |
| 7802 | { 6, alc883_3ST_ch6_intel_init }, |
| 7803 | }; |
| 7804 | |
| 7805 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7806 | * 2ch mode |
| 7807 | */ |
| 7808 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7809 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7810 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7811 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7812 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7813 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7814 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7815 | { } /* end */ |
| 7816 | }; |
| 7817 | |
| 7818 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7819 | * 6ch mode |
| 7820 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7821 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7822 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7823 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7824 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7825 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7826 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7827 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7828 | { } /* end */ |
| 7829 | }; |
| 7830 | |
| 7831 | /* |
| 7832 | * 8ch mode |
| 7833 | */ |
| 7834 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7835 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7836 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7837 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7838 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7839 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7840 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7841 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7842 | { } /* end */ |
| 7843 | }; |
| 7844 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7845 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7846 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7847 | { 6, alc889_ch6_intel_init }, |
| 7848 | { 8, alc889_ch8_intel_init }, |
| 7849 | }; |
| 7850 | |
| 7851 | /* |
| 7852 | * 6ch mode |
| 7853 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7854 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7855 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7856 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7857 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7858 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7859 | { } /* end */ |
| 7860 | }; |
| 7861 | |
| 7862 | /* |
| 7863 | * 8ch mode |
| 7864 | */ |
| 7865 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7866 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7867 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7868 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7869 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7870 | { } /* end */ |
| 7871 | }; |
| 7872 | |
| 7873 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7874 | { 6, alc883_sixstack_ch6_init }, |
| 7875 | { 8, alc883_sixstack_ch8_init }, |
| 7876 | }; |
| 7877 | |
| 7878 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7879 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7880 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7881 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7882 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7883 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7884 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7885 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7886 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7887 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7888 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7889 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7890 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7891 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7892 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7893 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7894 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7895 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7896 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7897 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7899 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7900 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7901 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7902 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7903 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7904 | { } /* end */ |
| 7905 | }; |
| 7906 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7907 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7908 | |
| 7909 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7910 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7911 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7912 | { } |
| 7913 | }; |
| 7914 | |
| 7915 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7916 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7917 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7918 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7919 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7920 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7921 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7923 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7925 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7926 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7927 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7928 | { } /* end */ |
| 7929 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7930 | |
| 7931 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7932 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7933 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7934 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7935 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7936 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7937 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7938 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7939 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7940 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7941 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7943 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7944 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7945 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7946 | { } /* end */ |
| 7947 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7948 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7949 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7950 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7951 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7952 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7953 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7954 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7955 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7956 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7957 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7958 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7959 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7960 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7961 | { } /* end */ |
| 7962 | }; |
| 7963 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7964 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7965 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7966 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7967 | { } /* end */ |
| 7968 | }; |
| 7969 | |
| 7970 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7971 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7972 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7973 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7974 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7975 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7976 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7977 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7978 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7979 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7981 | { } /* end */ |
| 7982 | }; |
| 7983 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7984 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7985 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7986 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7987 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7988 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7989 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7990 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7991 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7992 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7993 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7994 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7997 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7998 | { } /* end */ |
| 7999 | }; |
| 8000 | |
| 8001 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8002 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8003 | */ |
| 8004 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8006 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8007 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8008 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8009 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8010 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8011 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8012 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8013 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8014 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8015 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8016 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 8017 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8018 | { } /* end */ |
| 8019 | }; |
| 8020 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8021 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8022 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8023 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8024 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8025 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8026 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8027 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8028 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8029 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8030 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8031 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8032 | { } /* end */ |
| 8033 | }; |
| 8034 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8035 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8036 | { |
| 8037 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8038 | .name = "Channel Mode", |
| 8039 | .info = alc_ch_mode_info, |
| 8040 | .get = alc_ch_mode_get, |
| 8041 | .put = alc_ch_mode_put, |
| 8042 | }, |
| 8043 | { } /* end */ |
| 8044 | }; |
| 8045 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8046 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8047 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8048 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8049 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8050 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8051 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8052 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8053 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8054 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8056 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8057 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8058 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8059 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8060 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8062 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8063 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8064 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8066 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8067 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8068 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8069 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8070 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8071 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8072 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8073 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8074 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8075 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8076 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8077 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8079 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8080 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8081 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8082 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8083 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8084 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8085 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8086 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8087 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8088 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8089 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8090 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8091 | |
| 8092 | /* FIXME: use matrix-type input source selection */ |
| 8093 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8094 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8095 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8096 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8098 | /* ADC2: mute amp left and right */ |
| 8099 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8100 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8101 | /* ADC3: mute amp left and right */ |
| 8102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8103 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8104 | |
| 8105 | { } |
| 8106 | }; |
| 8107 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8108 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8109 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8110 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8111 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8112 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8113 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8114 | /* ADC1: mute amp left and right */ |
| 8115 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8116 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8117 | { } |
| 8118 | }; |
| 8119 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8120 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8121 | /* change to EAPD mode */ |
| 8122 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8123 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8124 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8125 | }; |
| 8126 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8127 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8128 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8129 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8130 | { } |
| 8131 | }; |
| 8132 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8133 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8134 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8135 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8136 | {} |
| 8137 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8138 | |
| 8139 | static struct hda_verb alc885_init_verbs[] = { |
| 8140 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8141 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8143 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8144 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8145 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8146 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8147 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8149 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8150 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8151 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8152 | |
| 8153 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8154 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8155 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8156 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8157 | /* Front Pin: output 0 (0x0c) */ |
| 8158 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8159 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8160 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8161 | /* Rear Pin: output 1 (0x0d) */ |
| 8162 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8164 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8165 | /* CLFE Pin: output 2 (0x0e) */ |
| 8166 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8167 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8168 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8169 | /* Side Pin: output 3 (0x0f) */ |
| 8170 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8171 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8172 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8173 | /* Mic (rear) pin: input vref at 80% */ |
| 8174 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8175 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8176 | /* Front Mic pin: input vref at 80% */ |
| 8177 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8178 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8179 | /* Line In pin: input */ |
| 8180 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8181 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8182 | |
| 8183 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8184 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8185 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8186 | /* Input mixer2 */ |
| 8187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8188 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8190 | /* ADC2: mute amp left and right */ |
| 8191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8192 | /* ADC3: mute amp left and right */ |
| 8193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8194 | |
| 8195 | { } |
| 8196 | }; |
| 8197 | |
| 8198 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8200 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8201 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8202 | { } |
| 8203 | }; |
| 8204 | |
| 8205 | |
| 8206 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8207 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8208 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8209 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8210 | { } |
| 8211 | }; |
| 8212 | |
| 8213 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8214 | #define alc883_init_verbs alc882_base_init_verbs |
| 8215 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8216 | /* Mac Pro test */ |
| 8217 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8218 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8219 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8220 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8222 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8223 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8224 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8225 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8226 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8227 | { } /* end */ |
| 8228 | }; |
| 8229 | |
| 8230 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8231 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8232 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8233 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8235 | /* Front Pin: output 0 (0x0c) */ |
| 8236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8239 | /* Front Mic pin: input vref at 80% */ |
| 8240 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8241 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8242 | /* Speaker: output */ |
| 8243 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8244 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8245 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8246 | /* Headphone output (output 0 - 0x0c) */ |
| 8247 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8248 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8249 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8250 | |
| 8251 | /* FIXME: use matrix-type input source selection */ |
| 8252 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8253 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8256 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8257 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8258 | /* Input mixer2 */ |
| 8259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8261 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8262 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8263 | /* Input mixer3 */ |
| 8264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8267 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8268 | /* ADC1: mute amp left and right */ |
| 8269 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8270 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8271 | /* ADC2: mute amp left and right */ |
| 8272 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8273 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8274 | /* ADC3: mute amp left and right */ |
| 8275 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8276 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8277 | |
| 8278 | { } |
| 8279 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8280 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8281 | /* Macbook 5,1 */ |
| 8282 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8283 | /* DACs */ |
| 8284 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8285 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8286 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8287 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8288 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8290 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8291 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8292 | /* Surround mixer */ |
| 8293 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8294 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8296 | /* LFE mixer */ |
| 8297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8299 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8300 | /* HP mixer */ |
| 8301 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8302 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8303 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8304 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8305 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8306 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8307 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8308 | /* LFE Pin (0x0e) */ |
| 8309 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8310 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8311 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8312 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8313 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8314 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8315 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8316 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8317 | /* Front Mic pin: input vref at 80% */ |
| 8318 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8319 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8320 | /* Line In pin */ |
| 8321 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8322 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8323 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8324 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8325 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8326 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8327 | { } |
| 8328 | }; |
| 8329 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8330 | /* Macmini 3,1 */ |
| 8331 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8332 | /* DACs */ |
| 8333 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8334 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8335 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8336 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8337 | /* Front mixer */ |
| 8338 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8339 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8340 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8341 | /* Surround mixer */ |
| 8342 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8344 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8345 | /* LFE mixer */ |
| 8346 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8349 | /* HP mixer */ |
| 8350 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8351 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8352 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8353 | /* Front Pin (0x0c) */ |
| 8354 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8355 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8356 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8357 | /* LFE Pin (0x0e) */ |
| 8358 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8359 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8360 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8361 | /* HP Pin (0x0f) */ |
| 8362 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8363 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8364 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8365 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8366 | /* Line In pin */ |
| 8367 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8368 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8369 | |
| 8370 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8371 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8372 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8373 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8374 | { } |
| 8375 | }; |
| 8376 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8377 | |
| 8378 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8379 | /*Internal and HP Speaker Mixer*/ |
| 8380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8382 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8383 | /*Internal Speaker Pin (0x0c)*/ |
| 8384 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8385 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8386 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8387 | /* HP Pin: output 0 (0x0e) */ |
| 8388 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8389 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8390 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8391 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8392 | /* Line in (is hp when jack connected)*/ |
| 8393 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8394 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8395 | |
| 8396 | { } |
| 8397 | }; |
| 8398 | |
| 8399 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8400 | /* Macbook Pro rev3 */ |
| 8401 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8402 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8405 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8406 | /* Rear mixer */ |
| 8407 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8408 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8409 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8410 | /* HP mixer */ |
| 8411 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8412 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8413 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8414 | /* Front Pin: output 0 (0x0c) */ |
| 8415 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8416 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8417 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8418 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8421 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8422 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8423 | /* Mic (rear) pin: input vref at 80% */ |
| 8424 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8425 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8426 | /* Front Mic pin: input vref at 80% */ |
| 8427 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8428 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8429 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8430 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8431 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8432 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8433 | |
| 8434 | /* FIXME: use matrix-type input source selection */ |
| 8435 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8436 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8437 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8439 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8440 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8441 | /* Input mixer2 */ |
| 8442 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8443 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8444 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8445 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8446 | /* Input mixer3 */ |
| 8447 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8448 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8449 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8450 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8451 | /* ADC1: mute amp left and right */ |
| 8452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8453 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8454 | /* ADC2: mute amp left and right */ |
| 8455 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8456 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8457 | /* ADC3: mute amp left and right */ |
| 8458 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8459 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8460 | |
| 8461 | { } |
| 8462 | }; |
| 8463 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8464 | /* iMac 9,1 */ |
| 8465 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8466 | /* Internal Speaker Pin (0x0c) */ |
| 8467 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8468 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8469 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8470 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8471 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8472 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8473 | /* HP Pin: Rear */ |
| 8474 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8475 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8476 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8477 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8478 | /* Line in Rear */ |
| 8479 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8480 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8481 | /* Front Mic pin: input vref at 80% */ |
| 8482 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8483 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8484 | /* Rear mixer */ |
| 8485 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8486 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8487 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8488 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8489 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8492 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8493 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8494 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8495 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8496 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8497 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8498 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8499 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8500 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8502 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8503 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8504 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8505 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8506 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8507 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8509 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8510 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8511 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8512 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8513 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8514 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8515 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8516 | { } |
| 8517 | }; |
| 8518 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8519 | /* iMac 24 mixer. */ |
| 8520 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8521 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8522 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8523 | { } /* end */ |
| 8524 | }; |
| 8525 | |
| 8526 | /* iMac 24 init verbs. */ |
| 8527 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8528 | /* Internal speakers: output 0 (0x0c) */ |
| 8529 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8530 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8531 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8532 | /* Internal speakers: output 0 (0x0c) */ |
| 8533 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8534 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8535 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8536 | /* Headphone: output 0 (0x0c) */ |
| 8537 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8538 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8539 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8540 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8541 | /* Front Mic: input vref at 80% */ |
| 8542 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8543 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8544 | { } |
| 8545 | }; |
| 8546 | |
| 8547 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8548 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8549 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8550 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8551 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8552 | spec->autocfg.hp_pins[0] = 0x14; |
| 8553 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8554 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8555 | } |
| 8556 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8557 | #define alc885_mb5_setup alc885_imac24_setup |
| 8558 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8559 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8560 | /* Macbook Air 2,1 */ |
| 8561 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8562 | { |
| 8563 | struct alc_spec *spec = codec->spec; |
| 8564 | |
| 8565 | spec->autocfg.hp_pins[0] = 0x14; |
| 8566 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8567 | } |
| 8568 | |
| 8569 | |
| 8570 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8571 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8572 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8573 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8574 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8575 | spec->autocfg.hp_pins[0] = 0x15; |
| 8576 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8577 | } |
| 8578 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8579 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8580 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8581 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8582 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8583 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8584 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8585 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8586 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8587 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8588 | static struct hda_verb alc882_targa_verbs[] = { |
| 8589 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8591 | |
| 8592 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8593 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8594 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8595 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8596 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8597 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8598 | |
| 8599 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8600 | { } /* end */ |
| 8601 | }; |
| 8602 | |
| 8603 | /* toggle speaker-output according to the hp-jack state */ |
| 8604 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8605 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8606 | struct alc_spec *spec = codec->spec; |
| 8607 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8608 | 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] | 8609 | spec->jack_present ? 1 : 3); |
| 8610 | } |
| 8611 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8612 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8613 | { |
| 8614 | struct alc_spec *spec = codec->spec; |
| 8615 | |
| 8616 | spec->autocfg.hp_pins[0] = 0x14; |
| 8617 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8618 | } |
| 8619 | |
| 8620 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8621 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8622 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8623 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8624 | } |
| 8625 | |
| 8626 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8627 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8629 | |
| 8630 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8631 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8632 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8633 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8634 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8635 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8636 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8637 | |
| 8638 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8639 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8640 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8641 | { } /* end */ |
| 8642 | }; |
| 8643 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8644 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8645 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8646 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8647 | |
| 8648 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8650 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8651 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8652 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8653 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8654 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8655 | |
| 8656 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8657 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8658 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8659 | { } /* end */ |
| 8660 | }; |
| 8661 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8662 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8663 | { |
| 8664 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8665 | |
| 8666 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8667 | AC_VERB_GET_GPIO_DATA, 0); |
| 8668 | |
| 8669 | if (!muted) |
| 8670 | gpiostate |= (1 << pin); |
| 8671 | else |
| 8672 | gpiostate &= ~(1 << pin); |
| 8673 | |
| 8674 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8675 | AC_VERB_GET_GPIO_MASK, 0); |
| 8676 | gpiomask |= (1 << pin); |
| 8677 | |
| 8678 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8679 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8680 | gpiodir |= (1 << pin); |
| 8681 | |
| 8682 | |
| 8683 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8684 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8685 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8686 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8687 | |
| 8688 | msleep(1); |
| 8689 | |
| 8690 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8691 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8692 | } |
| 8693 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8694 | /* set up GPIO at initialization */ |
| 8695 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8696 | { |
| 8697 | alc882_gpio_mute(codec, 0, 0); |
| 8698 | alc882_gpio_mute(codec, 1, 0); |
| 8699 | } |
| 8700 | |
| 8701 | /* set up GPIO and update auto-muting at initialization */ |
| 8702 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8703 | { |
| 8704 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8705 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8706 | } |
| 8707 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8708 | /* |
| 8709 | * generic initialization of ADC, input mixers and output mixers |
| 8710 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8711 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8712 | /* |
| 8713 | * Unmute ADC0-2 and set the default input to mic-in |
| 8714 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8715 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8716 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8717 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8718 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8719 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8720 | /* |
| 8721 | * Set up output mixers (0x0c - 0x0f) |
| 8722 | */ |
| 8723 | /* set vol=0 to output mixers */ |
| 8724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8725 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8726 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8727 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8728 | /* set up input amps for analog loopback */ |
| 8729 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8730 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8731 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8732 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8733 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8734 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8735 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8736 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8737 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8738 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8739 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8740 | |
| 8741 | /* FIXME: use matrix-type input source selection */ |
| 8742 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8743 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8744 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8745 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8746 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8747 | { } |
| 8748 | }; |
| 8749 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8750 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8751 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8752 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8753 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8754 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8755 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8756 | { } /* end */ |
| 8757 | }; |
| 8758 | |
| 8759 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8760 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8761 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8762 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8763 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8764 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8765 | { } /* end */ |
| 8766 | }; |
| 8767 | |
| 8768 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8769 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8770 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8771 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8772 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8773 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8774 | { } /* end */ |
| 8775 | }; |
| 8776 | |
| 8777 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8778 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8779 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8780 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8781 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8782 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8783 | { } /* end */ |
| 8784 | }; |
| 8785 | |
| 8786 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8787 | { 2, alc889A_mb31_ch2_init }, |
| 8788 | { 4, alc889A_mb31_ch4_init }, |
| 8789 | { 5, alc889A_mb31_ch5_init }, |
| 8790 | { 6, alc889A_mb31_ch6_init }, |
| 8791 | }; |
| 8792 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8793 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8794 | /* eanable EAPD on medion laptop */ |
| 8795 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8796 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8797 | { } |
| 8798 | }; |
| 8799 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8800 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8801 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8802 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8803 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8804 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8805 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8806 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8807 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8808 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8809 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8811 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8813 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8814 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8815 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8816 | { } /* end */ |
| 8817 | }; |
| 8818 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8819 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8820 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8821 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8822 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8823 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8824 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8825 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8827 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8828 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8829 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8830 | { } /* end */ |
| 8831 | }; |
| 8832 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8833 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8834 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8835 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8836 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8837 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8839 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8841 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8842 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8843 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8844 | { } /* end */ |
| 8845 | }; |
| 8846 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8847 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8848 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8849 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8850 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8851 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8852 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8853 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8854 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8856 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8858 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8859 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8860 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8861 | { } /* end */ |
| 8862 | }; |
| 8863 | |
| 8864 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8865 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8866 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8867 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8868 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8869 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8870 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8871 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8872 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8873 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8874 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8875 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8876 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8877 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8879 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8880 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8881 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8882 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8883 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8884 | { } /* end */ |
| 8885 | }; |
| 8886 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8887 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8888 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8889 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8890 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8891 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8892 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8893 | HDA_OUTPUT), |
| 8894 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8895 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8896 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8897 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8898 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8899 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8900 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8901 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8903 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8904 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8905 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8906 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8907 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8908 | { } /* end */ |
| 8909 | }; |
| 8910 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8911 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8912 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8913 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8914 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8915 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8916 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8917 | HDA_OUTPUT), |
| 8918 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8919 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8920 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8921 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8922 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8923 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8924 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8925 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8926 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8927 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8928 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8929 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8930 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8931 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8932 | { } /* end */ |
| 8933 | }; |
| 8934 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8935 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8936 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8937 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8938 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8939 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8940 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8941 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8942 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8943 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8944 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8945 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8946 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8947 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8948 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8949 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8950 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8951 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8952 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8953 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8954 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8955 | { } /* end */ |
| 8956 | }; |
| 8957 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8958 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8960 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8961 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8962 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8963 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8964 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8965 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8966 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8967 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8968 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8969 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8970 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8971 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8972 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8974 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8976 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8977 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8978 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8979 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8980 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8981 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8982 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8983 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8984 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8985 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8986 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8987 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8988 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8989 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8990 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8991 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8992 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8993 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8994 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8995 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8996 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8997 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8998 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8999 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9000 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9001 | { } /* end */ |
| 9002 | }; |
| 9003 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9004 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9006 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9007 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9008 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9010 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9011 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9013 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9014 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9015 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9016 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9017 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9018 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9019 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9020 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9021 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9022 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 9024 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9025 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9026 | { } /* end */ |
| 9027 | }; |
| 9028 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9029 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9030 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9031 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9032 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9033 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9034 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9035 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9036 | { } /* end */ |
| 9037 | }; |
| 9038 | |
| 9039 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9040 | /* Unmute front mixer */ |
| 9041 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9042 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9043 | |
| 9044 | /* Set speaker pin to front mixer */ |
| 9045 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9046 | |
| 9047 | /* Init headphone pin */ |
| 9048 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9049 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9050 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9051 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9052 | |
| 9053 | { } /* end */ |
| 9054 | }; |
| 9055 | |
| 9056 | /* toggle speaker-output according to the hp-jack state */ |
| 9057 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9058 | { |
| 9059 | struct alc_spec *spec = codec->spec; |
| 9060 | |
| 9061 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9062 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9063 | } |
| 9064 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9065 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9066 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9067 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9068 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9069 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9070 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9071 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9072 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9073 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9074 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9075 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9076 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9077 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9078 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9079 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9080 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9081 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9082 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9083 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9085 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9086 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9087 | { } /* end */ |
| 9088 | }; |
| 9089 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9090 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9092 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9093 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9094 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9095 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9096 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9097 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9098 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9099 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9100 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9101 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9102 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9103 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9104 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9105 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9106 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9107 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9109 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9110 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9111 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9112 | { } /* end */ |
| 9113 | }; |
| 9114 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9115 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9116 | /* Output mixers */ |
| 9117 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9118 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9119 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9120 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9121 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9122 | HDA_OUTPUT), |
| 9123 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9124 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9125 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9126 | /* Output switches */ |
| 9127 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9128 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9129 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9130 | /* Boost mixers */ |
| 9131 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 9132 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 9133 | /* Input mixers */ |
| 9134 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9135 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9136 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9137 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9138 | { } /* end */ |
| 9139 | }; |
| 9140 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9141 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9142 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9143 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9144 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9145 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9146 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 9147 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9148 | { } /* end */ |
| 9149 | }; |
| 9150 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9151 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9152 | .ops = &snd_hda_bind_vol, |
| 9153 | .values = { |
| 9154 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9155 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9156 | 0 |
| 9157 | }, |
| 9158 | }; |
| 9159 | |
| 9160 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9161 | .ops = &snd_hda_bind_sw, |
| 9162 | .values = { |
| 9163 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9164 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9165 | 0 |
| 9166 | }, |
| 9167 | }; |
| 9168 | |
| 9169 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9170 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9171 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9172 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9174 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9175 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9176 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9177 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9178 | { } /* end */ |
| 9179 | }; |
| 9180 | |
| 9181 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9182 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9183 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9184 | { |
| 9185 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9186 | /* .name = "Capture Source", */ |
| 9187 | .name = "Input Source", |
| 9188 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9189 | .info = alc_mux_enum_info, |
| 9190 | .get = alc_mux_enum_get, |
| 9191 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9192 | }, |
| 9193 | { } /* end */ |
| 9194 | }; |
| 9195 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9196 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9197 | { |
| 9198 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9199 | .name = "Channel Mode", |
| 9200 | .info = alc_ch_mode_info, |
| 9201 | .get = alc_ch_mode_get, |
| 9202 | .put = alc_ch_mode_put, |
| 9203 | }, |
| 9204 | { } /* end */ |
| 9205 | }; |
| 9206 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9207 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9208 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9209 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9210 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9211 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9212 | spec->autocfg.hp_pins[0] = 0x15; |
| 9213 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9214 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9215 | } |
| 9216 | |
| 9217 | /* auto-toggle front mic */ |
| 9218 | /* |
| 9219 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 9220 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9221 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9222 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9223 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 9224 | } |
| 9225 | */ |
| 9226 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9227 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9228 | /* HP */ |
| 9229 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9230 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9231 | /* Subwoofer */ |
| 9232 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9233 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9234 | |
| 9235 | /* enable unsolicited event */ |
| 9236 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9237 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9238 | |
| 9239 | { } /* end */ |
| 9240 | }; |
| 9241 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9242 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9243 | /* HP */ |
| 9244 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9245 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9246 | /* Int speaker */ |
| 9247 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9248 | |
| 9249 | /* enable unsolicited event */ |
| 9250 | /* |
| 9251 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9252 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9253 | */ |
| 9254 | |
| 9255 | { } /* end */ |
| 9256 | }; |
| 9257 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9258 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9259 | /* HP */ |
| 9260 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9261 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9262 | /* Int speaker */ |
| 9263 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9264 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9265 | |
| 9266 | /* enable unsolicited event */ |
| 9267 | {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] | 9268 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9269 | |
| 9270 | { } /* end */ |
| 9271 | }; |
| 9272 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9273 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9274 | /* HP */ |
| 9275 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9276 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9277 | /* Subwoofer */ |
| 9278 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9279 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9280 | |
| 9281 | /* enable unsolicited event */ |
| 9282 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9283 | |
| 9284 | { } /* end */ |
| 9285 | }; |
| 9286 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9287 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9290 | |
| 9291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9292 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9293 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9294 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9295 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9296 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9297 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9298 | /* Connect Mic jack to CLFE */ |
| 9299 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9300 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9301 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9302 | /* Connect Line-in jack to Surround */ |
| 9303 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9304 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9305 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9306 | /* Connect HP out jack to Front */ |
| 9307 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9308 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9309 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9310 | |
| 9311 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9312 | |
| 9313 | { } /* end */ |
| 9314 | }; |
| 9315 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9316 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9317 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9318 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9319 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9320 | { } /* end */ |
| 9321 | }; |
| 9322 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9323 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9324 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9325 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9326 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9328 | { } /* end */ |
| 9329 | }; |
| 9330 | |
| 9331 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9332 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9334 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9335 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9336 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9337 | { } /* end */ |
| 9338 | }; |
| 9339 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9340 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9342 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9343 | |
| 9344 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9345 | |
| 9346 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9347 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9348 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9349 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9350 | { } /* end */ |
| 9351 | }; |
| 9352 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9353 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9354 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9355 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9356 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9357 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9358 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9359 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9360 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9361 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9362 | { } /* end */ |
| 9363 | }; |
| 9364 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9365 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9366 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9367 | { } |
| 9368 | }; |
| 9369 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9370 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9371 | /* HP */ |
| 9372 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9373 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9374 | |
| 9375 | /* enable unsolicited event */ |
| 9376 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9377 | |
| 9378 | { } /* end */ |
| 9379 | }; |
| 9380 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9381 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9382 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9383 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9384 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9385 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9386 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9387 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9388 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9389 | } |
| 9390 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9391 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9392 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9393 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9394 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9395 | {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] | 9396 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9397 | }; |
| 9398 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9399 | /* |
| 9400 | * 2ch mode |
| 9401 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9402 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9403 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9404 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9405 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9406 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9407 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9408 | }; |
| 9409 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9410 | /* |
| 9411 | * 4ch mode |
| 9412 | */ |
| 9413 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9414 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9415 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9416 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9417 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9418 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9419 | { } /* end */ |
| 9420 | }; |
| 9421 | |
| 9422 | /* |
| 9423 | * 6ch mode |
| 9424 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9425 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9426 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9427 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9428 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9429 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9430 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9431 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9432 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9433 | }; |
| 9434 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9435 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9436 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9437 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9438 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9439 | }; |
| 9440 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9441 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9442 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9443 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9444 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9445 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9446 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9447 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9448 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9449 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9450 | } |
| 9451 | |
| 9452 | /* toggle RCA according to the front-jack state */ |
| 9453 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9454 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9455 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9456 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9457 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9458 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9459 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9460 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9461 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9462 | unsigned int res) |
| 9463 | { |
| 9464 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9465 | alc888_lenovo_ms7195_front_automute(codec); |
| 9466 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9467 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9468 | } |
| 9469 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9470 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9471 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9472 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9473 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9474 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9475 | spec->autocfg.hp_pins[0] = 0x14; |
| 9476 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9477 | } |
| 9478 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9479 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9480 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9481 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9482 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9483 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9484 | { |
| 9485 | unsigned int present; |
| 9486 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9487 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9488 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9489 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9490 | } |
| 9491 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9492 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9493 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9494 | struct alc_spec *spec = codec->spec; |
| 9495 | |
| 9496 | spec->autocfg.hp_pins[0] = 0x15; |
| 9497 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9498 | } |
| 9499 | |
| 9500 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9501 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9502 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9503 | alc883_clevo_m720_mic_automute(codec); |
| 9504 | } |
| 9505 | |
| 9506 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9507 | unsigned int res) |
| 9508 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9509 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9510 | case ALC880_MIC_EVENT: |
| 9511 | alc883_clevo_m720_mic_automute(codec); |
| 9512 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9513 | default: |
| 9514 | alc_automute_amp_unsol_event(codec, res); |
| 9515 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9516 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9517 | } |
| 9518 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9519 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9520 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9521 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9522 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9523 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9524 | spec->autocfg.hp_pins[0] = 0x14; |
| 9525 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9526 | } |
| 9527 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9528 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9529 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9530 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9531 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9532 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9533 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9534 | } |
| 9535 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9536 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9537 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9538 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9539 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9540 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9541 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9542 | } |
| 9543 | |
| 9544 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9545 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9546 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9547 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9548 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9549 | HDA_AMP_MUTE, bits); |
| 9550 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9551 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9552 | } |
| 9553 | |
| 9554 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9555 | unsigned int res) |
| 9556 | { |
| 9557 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9558 | alc883_lenovo_101e_all_automute(codec); |
| 9559 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9560 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9561 | } |
| 9562 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9563 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9564 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9565 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9566 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9567 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9568 | spec->autocfg.hp_pins[0] = 0x14; |
| 9569 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9570 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9571 | } |
| 9572 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9573 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9574 | /* HP Pin: output 0 (0x0c) */ |
| 9575 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9577 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9578 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9579 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9580 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9581 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9582 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9583 | /* eanable EAPD on medion laptop */ |
| 9584 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9585 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9586 | /* enable unsolicited event */ |
| 9587 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9588 | { } |
| 9589 | }; |
| 9590 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9591 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9592 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9593 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9594 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9595 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9596 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9597 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9598 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9599 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9600 | } |
| 9601 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9602 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9603 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9604 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9605 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9606 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9607 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9608 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9609 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9610 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9611 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9612 | } |
| 9613 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9614 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9615 | { |
| 9616 | struct alc_spec *spec = codec->spec; |
| 9617 | |
| 9618 | spec->autocfg.hp_pins[0] = 0x15; |
| 9619 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9620 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9621 | } |
| 9622 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9623 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9625 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9626 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9627 | /* enable unsolicited event */ |
| 9628 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9629 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9630 | { } /* end */ |
| 9631 | }; |
| 9632 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9633 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9634 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9635 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9636 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9637 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9638 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9639 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9640 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9641 | spec->ext_mic.pin = 0x18; |
| 9642 | spec->int_mic.pin = 0x19; |
| 9643 | spec->ext_mic.mux_idx = 0; |
| 9644 | spec->int_mic.mux_idx = 1; |
| 9645 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9646 | } |
| 9647 | |
| 9648 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9650 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9651 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9652 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9653 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9654 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9655 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9656 | /* enable unsolicited event */ |
| 9657 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9658 | { } /* end */ |
| 9659 | }; |
| 9660 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9661 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9662 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9663 | struct alc_spec *spec = codec->spec; |
| 9664 | |
| 9665 | spec->autocfg.hp_pins[0] = 0x14; |
| 9666 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9667 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9668 | } |
| 9669 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9670 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9671 | /* Init rear pin (used as headphone output) */ |
| 9672 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9673 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9674 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9675 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9676 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9677 | /* Init line 2 pin (used as headphone out by default) */ |
| 9678 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9679 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9680 | { } /* end */ |
| 9681 | }; |
| 9682 | |
| 9683 | /* Mute speakers according to the headphone jack state */ |
| 9684 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9685 | { |
| 9686 | unsigned int present; |
| 9687 | |
| 9688 | /* Mute only in 2ch or 4ch mode */ |
| 9689 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9690 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9691 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9692 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9693 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9694 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9695 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9696 | } |
| 9697 | } |
| 9698 | |
| 9699 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9700 | { |
| 9701 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9702 | alc889A_mb31_automute(codec); |
| 9703 | } |
| 9704 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9705 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9706 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9707 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9708 | #endif |
| 9709 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9710 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9711 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9712 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9713 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9714 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9715 | |
| 9716 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9717 | ALC1200_DIGOUT_NID, 0, |
| 9718 | }; |
| 9719 | |
| 9720 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9721 | ALC883_DIGOUT_NID, 0, |
| 9722 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9723 | |
| 9724 | /* |
| 9725 | * configuration and preset |
| 9726 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9727 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9728 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9729 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9730 | [ALC882_ARIMA] = "arima", |
| 9731 | [ALC882_W2JC] = "w2jc", |
| 9732 | [ALC882_TARGA] = "targa", |
| 9733 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9734 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9735 | [ALC885_MACPRO] = "macpro", |
| 9736 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9737 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9738 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9739 | [ALC885_MBP3] = "mbp3", |
| 9740 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9741 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9742 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9743 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9744 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9745 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9746 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9747 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9748 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9749 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9750 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9751 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9752 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9753 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9754 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9755 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9756 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9757 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9758 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9759 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9760 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9761 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9762 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9763 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9764 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9765 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9766 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9767 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9768 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9769 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9770 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9771 | [ALC889A_INTEL] = "intel-alc889a", |
| 9772 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9773 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9774 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9775 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9776 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9777 | }; |
| 9778 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9779 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9780 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9781 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9782 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9783 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9784 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9785 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9786 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9787 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9788 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9789 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9790 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9791 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9792 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9793 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9794 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9795 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9796 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9797 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9798 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9799 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9800 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9801 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9802 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9803 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9804 | /* default Acer -- disabled as it causes more problems. |
| 9805 | * model=auto should work fine now |
| 9806 | */ |
| 9807 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9808 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9809 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9810 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9811 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9812 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9813 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9814 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9815 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9816 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9817 | |
| 9818 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9819 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9820 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9821 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9822 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9823 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9824 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9825 | 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] | 9826 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9827 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9828 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9829 | |
| 9830 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9831 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9832 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9833 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9834 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9835 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9836 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9837 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9838 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9839 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9840 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9841 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9842 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9843 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9844 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9845 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9846 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9847 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9848 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9849 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9850 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9851 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9852 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9853 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9854 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9855 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9856 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9857 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9858 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9859 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9860 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9861 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9862 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9863 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9864 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9865 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9867 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9868 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9869 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9870 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9871 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9872 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9874 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9875 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9876 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9877 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9878 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9879 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9880 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9881 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9882 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9883 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9884 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9885 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9886 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9887 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9888 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9889 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9890 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9891 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9892 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9893 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9894 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9895 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9896 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9897 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9898 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9899 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9900 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9901 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9902 | {} |
| 9903 | }; |
| 9904 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9905 | /* codec SSID table for Intel Mac */ |
| 9906 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9907 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9908 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9909 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9910 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9911 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9912 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9913 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9914 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9915 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), |
Justin P. Mattock | f53dae2 | 2010-06-06 16:09:51 -0700 | [diff] [blame] | 9916 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9917 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9918 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9919 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9920 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9921 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9922 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9923 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9924 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9925 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9926 | */ |
| 9927 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9928 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9929 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9930 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9931 | }; |
| 9932 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9933 | static struct alc_config_preset alc882_presets[] = { |
| 9934 | [ALC882_3ST_DIG] = { |
| 9935 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9936 | .init_verbs = { alc882_base_init_verbs, |
| 9937 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9938 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9939 | .dac_nids = alc882_dac_nids, |
| 9940 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9941 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9942 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9943 | .channel_mode = alc882_ch_modes, |
| 9944 | .need_dac_fix = 1, |
| 9945 | .input_mux = &alc882_capture_source, |
| 9946 | }, |
| 9947 | [ALC882_6ST_DIG] = { |
| 9948 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9949 | .init_verbs = { alc882_base_init_verbs, |
| 9950 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9951 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9952 | .dac_nids = alc882_dac_nids, |
| 9953 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9954 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9955 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9956 | .channel_mode = alc882_sixstack_modes, |
| 9957 | .input_mux = &alc882_capture_source, |
| 9958 | }, |
| 9959 | [ALC882_ARIMA] = { |
| 9960 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9961 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9962 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9963 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9964 | .dac_nids = alc882_dac_nids, |
| 9965 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9966 | .channel_mode = alc882_sixstack_modes, |
| 9967 | .input_mux = &alc882_capture_source, |
| 9968 | }, |
| 9969 | [ALC882_W2JC] = { |
| 9970 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9971 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9972 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9973 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9974 | .dac_nids = alc882_dac_nids, |
| 9975 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9976 | .channel_mode = alc880_threestack_modes, |
| 9977 | .need_dac_fix = 1, |
| 9978 | .input_mux = &alc882_capture_source, |
| 9979 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9980 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9981 | [ALC885_MBA21] = { |
| 9982 | .mixers = { alc885_mba21_mixer }, |
| 9983 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9984 | .num_dacs = 2, |
| 9985 | .dac_nids = alc882_dac_nids, |
| 9986 | .channel_mode = alc885_mba21_ch_modes, |
| 9987 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9988 | .input_mux = &alc882_capture_source, |
| 9989 | .unsol_event = alc_automute_amp_unsol_event, |
| 9990 | .setup = alc885_mba21_setup, |
| 9991 | .init_hook = alc_automute_amp, |
| 9992 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9993 | [ALC885_MBP3] = { |
| 9994 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9995 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9996 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9997 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9998 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9999 | .hp_nid = 0x04, |
| 10000 | .channel_mode = alc885_mbp_4ch_modes, |
| 10001 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10002 | .input_mux = &alc882_capture_source, |
| 10003 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10004 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10005 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10006 | .setup = alc885_mbp3_setup, |
| 10007 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10008 | }, |
| 10009 | [ALC885_MB5] = { |
| 10010 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10011 | .init_verbs = { alc885_mb5_init_verbs, |
| 10012 | alc880_gpio1_init_verbs }, |
| 10013 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10014 | .dac_nids = alc882_dac_nids, |
| 10015 | .channel_mode = alc885_mb5_6ch_modes, |
| 10016 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10017 | .input_mux = &mb5_capture_source, |
| 10018 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10019 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10020 | .unsol_event = alc_automute_amp_unsol_event, |
| 10021 | .setup = alc885_mb5_setup, |
| 10022 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10023 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10024 | [ALC885_MACMINI3] = { |
| 10025 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10026 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10027 | alc880_gpio1_init_verbs }, |
| 10028 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10029 | .dac_nids = alc882_dac_nids, |
| 10030 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10031 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10032 | .input_mux = &macmini3_capture_source, |
| 10033 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10034 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10035 | .unsol_event = alc_automute_amp_unsol_event, |
| 10036 | .setup = alc885_macmini3_setup, |
| 10037 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10038 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10039 | [ALC885_MACPRO] = { |
| 10040 | .mixers = { alc882_macpro_mixer }, |
| 10041 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10042 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10043 | .dac_nids = alc882_dac_nids, |
| 10044 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10045 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10046 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10047 | .channel_mode = alc882_ch_modes, |
| 10048 | .input_mux = &alc882_capture_source, |
| 10049 | .init_hook = alc885_macpro_init_hook, |
| 10050 | }, |
| 10051 | [ALC885_IMAC24] = { |
| 10052 | .mixers = { alc885_imac24_mixer }, |
| 10053 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10054 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10055 | .dac_nids = alc882_dac_nids, |
| 10056 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10057 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10058 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10059 | .channel_mode = alc882_ch_modes, |
| 10060 | .input_mux = &alc882_capture_source, |
| 10061 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10062 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10063 | .init_hook = alc885_imac24_init_hook, |
| 10064 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10065 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10066 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10067 | .init_verbs = { alc885_imac91_init_verbs, |
| 10068 | alc880_gpio1_init_verbs }, |
| 10069 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10070 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10071 | .channel_mode = alc885_mba21_ch_modes, |
| 10072 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10073 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10074 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10075 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10076 | .unsol_event = alc_automute_amp_unsol_event, |
| 10077 | .setup = alc885_imac91_setup, |
| 10078 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10079 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10080 | [ALC882_TARGA] = { |
| 10081 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10082 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10083 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10084 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10085 | .dac_nids = alc882_dac_nids, |
| 10086 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10087 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10088 | .adc_nids = alc882_adc_nids, |
| 10089 | .capsrc_nids = alc882_capsrc_nids, |
| 10090 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10091 | .channel_mode = alc882_3ST_6ch_modes, |
| 10092 | .need_dac_fix = 1, |
| 10093 | .input_mux = &alc882_capture_source, |
| 10094 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10095 | .setup = alc882_targa_setup, |
| 10096 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10097 | }, |
| 10098 | [ALC882_ASUS_A7J] = { |
| 10099 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10100 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10101 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10102 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10103 | .dac_nids = alc882_dac_nids, |
| 10104 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10105 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10106 | .adc_nids = alc882_adc_nids, |
| 10107 | .capsrc_nids = alc882_capsrc_nids, |
| 10108 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10109 | .channel_mode = alc882_3ST_6ch_modes, |
| 10110 | .need_dac_fix = 1, |
| 10111 | .input_mux = &alc882_capture_source, |
| 10112 | }, |
| 10113 | [ALC882_ASUS_A7M] = { |
| 10114 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10115 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10116 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10117 | alc882_asus_a7m_verbs }, |
| 10118 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10119 | .dac_nids = alc882_dac_nids, |
| 10120 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10121 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10122 | .channel_mode = alc880_threestack_modes, |
| 10123 | .need_dac_fix = 1, |
| 10124 | .input_mux = &alc882_capture_source, |
| 10125 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10126 | [ALC883_3ST_2ch_DIG] = { |
| 10127 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10128 | .init_verbs = { alc883_init_verbs }, |
| 10129 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10130 | .dac_nids = alc883_dac_nids, |
| 10131 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10132 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10133 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10134 | .channel_mode = alc883_3ST_2ch_modes, |
| 10135 | .input_mux = &alc883_capture_source, |
| 10136 | }, |
| 10137 | [ALC883_3ST_6ch_DIG] = { |
| 10138 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10139 | .init_verbs = { alc883_init_verbs }, |
| 10140 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10141 | .dac_nids = alc883_dac_nids, |
| 10142 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10143 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10144 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10145 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10146 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10147 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10148 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10149 | [ALC883_3ST_6ch] = { |
| 10150 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10151 | .init_verbs = { alc883_init_verbs }, |
| 10152 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10153 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10154 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10155 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10156 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10157 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10158 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10159 | [ALC883_3ST_6ch_INTEL] = { |
| 10160 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10161 | .init_verbs = { alc883_init_verbs }, |
| 10162 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10163 | .dac_nids = alc883_dac_nids, |
| 10164 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10165 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10166 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10167 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10168 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10169 | .need_dac_fix = 1, |
| 10170 | .input_mux = &alc883_3stack_6ch_intel, |
| 10171 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10172 | [ALC889A_INTEL] = { |
| 10173 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10174 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10175 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10176 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10177 | .dac_nids = alc883_dac_nids, |
| 10178 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10179 | .adc_nids = alc889_adc_nids, |
| 10180 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10181 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10182 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10183 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10184 | .channel_mode = alc889_8ch_intel_modes, |
| 10185 | .capsrc_nids = alc889_capsrc_nids, |
| 10186 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10187 | .setup = alc889_automute_setup, |
| 10188 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10189 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10190 | .need_dac_fix = 1, |
| 10191 | }, |
| 10192 | [ALC889_INTEL] = { |
| 10193 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10194 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10195 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10196 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10197 | .dac_nids = alc883_dac_nids, |
| 10198 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10199 | .adc_nids = alc889_adc_nids, |
| 10200 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10201 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10202 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10203 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10204 | .channel_mode = alc889_8ch_intel_modes, |
| 10205 | .capsrc_nids = alc889_capsrc_nids, |
| 10206 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10207 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10208 | .init_hook = alc889_intel_init_hook, |
| 10209 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10210 | .need_dac_fix = 1, |
| 10211 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10212 | [ALC883_6ST_DIG] = { |
| 10213 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10214 | .init_verbs = { alc883_init_verbs }, |
| 10215 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10216 | .dac_nids = alc883_dac_nids, |
| 10217 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10218 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10219 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10220 | .channel_mode = alc883_sixstack_modes, |
| 10221 | .input_mux = &alc883_capture_source, |
| 10222 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10223 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10224 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10225 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10226 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10227 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10228 | .dac_nids = alc883_dac_nids, |
| 10229 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10230 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10231 | .channel_mode = alc883_3ST_6ch_modes, |
| 10232 | .need_dac_fix = 1, |
| 10233 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10234 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10235 | .setup = alc882_targa_setup, |
| 10236 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10237 | }, |
| 10238 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10239 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10240 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10241 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10242 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10243 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10244 | .adc_nids = alc883_adc_nids_alt, |
| 10245 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10246 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10247 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10248 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10249 | .channel_mode = alc883_3ST_2ch_modes, |
| 10250 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10251 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10252 | .setup = alc882_targa_setup, |
| 10253 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10254 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10255 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10256 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10257 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10258 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10259 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10260 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10261 | .dac_nids = alc883_dac_nids, |
| 10262 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10263 | .adc_nids = alc883_adc_nids_rev, |
| 10264 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10265 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10266 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10267 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10268 | .channel_mode = alc883_4ST_8ch_modes, |
| 10269 | .need_dac_fix = 1, |
| 10270 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10271 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10272 | .setup = alc882_targa_setup, |
| 10273 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10274 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10275 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10276 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10277 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10278 | * and the headphone jack. Turn this on and rely on the |
| 10279 | * standard mute methods whenever the user wants to turn |
| 10280 | * these outputs off. |
| 10281 | */ |
| 10282 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10283 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10284 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10285 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10286 | .channel_mode = alc883_3ST_2ch_modes, |
| 10287 | .input_mux = &alc883_capture_source, |
| 10288 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10289 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10290 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10291 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10292 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10293 | .dac_nids = alc883_dac_nids, |
| 10294 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10295 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10296 | .channel_mode = alc883_3ST_2ch_modes, |
| 10297 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10298 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10299 | .setup = alc883_acer_aspire_setup, |
| 10300 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10301 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10302 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10303 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10304 | alc883_chmode_mixer }, |
| 10305 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10306 | alc888_acer_aspire_4930g_verbs }, |
| 10307 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10308 | .dac_nids = alc883_dac_nids, |
| 10309 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10310 | .adc_nids = alc883_adc_nids_rev, |
| 10311 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10312 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10313 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10314 | .channel_mode = alc883_3ST_6ch_modes, |
| 10315 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10316 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10317 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10318 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10319 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10320 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10321 | .setup = alc888_acer_aspire_4930g_setup, |
| 10322 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10323 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10324 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10325 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10326 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10327 | alc888_acer_aspire_6530g_verbs }, |
| 10328 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10329 | .dac_nids = alc883_dac_nids, |
| 10330 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10331 | .adc_nids = alc883_adc_nids_rev, |
| 10332 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10333 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10334 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10335 | .channel_mode = alc883_3ST_2ch_modes, |
| 10336 | .num_mux_defs = |
| 10337 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10338 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10339 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10340 | .setup = alc888_acer_aspire_6530g_setup, |
| 10341 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10342 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10343 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10344 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10345 | alc883_chmode_mixer }, |
| 10346 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10347 | alc889_acer_aspire_8930g_verbs, |
| 10348 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10349 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10350 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10351 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10352 | .adc_nids = alc889_adc_nids, |
| 10353 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10354 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10355 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10356 | .channel_mode = alc883_3ST_6ch_modes, |
| 10357 | .need_dac_fix = 1, |
| 10358 | .const_channel_count = 6, |
| 10359 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10360 | ARRAY_SIZE(alc889_capture_sources), |
| 10361 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10362 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10363 | .setup = alc889_acer_aspire_8930g_setup, |
| 10364 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10365 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10366 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10367 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10368 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10369 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10370 | .mixers = { alc883_3ST_6ch_mixer, |
| 10371 | alc883_chmode_mixer }, |
| 10372 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10373 | alc888_acer_aspire_7730G_verbs }, |
| 10374 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10375 | .dac_nids = alc883_dac_nids, |
| 10376 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10377 | .adc_nids = alc883_adc_nids_rev, |
| 10378 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10379 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10380 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10381 | .channel_mode = alc883_3ST_6ch_modes, |
| 10382 | .need_dac_fix = 1, |
| 10383 | .const_channel_count = 6, |
| 10384 | .input_mux = &alc883_capture_source, |
| 10385 | .unsol_event = alc_automute_amp_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10386 | .setup = alc888_acer_aspire_7730g_setup, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10387 | .init_hook = alc_automute_amp, |
| 10388 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10389 | [ALC883_MEDION] = { |
| 10390 | .mixers = { alc883_fivestack_mixer, |
| 10391 | alc883_chmode_mixer }, |
| 10392 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10393 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10394 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10395 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10396 | .adc_nids = alc883_adc_nids_alt, |
| 10397 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10398 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10399 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10400 | .channel_mode = alc883_sixstack_modes, |
| 10401 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10402 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10403 | [ALC883_MEDION_WIM2160] = { |
| 10404 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10405 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10406 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10407 | .dac_nids = alc883_dac_nids, |
| 10408 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10409 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10410 | .adc_nids = alc883_adc_nids, |
| 10411 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10412 | .channel_mode = alc883_3ST_2ch_modes, |
| 10413 | .input_mux = &alc883_capture_source, |
| 10414 | .unsol_event = alc_automute_amp_unsol_event, |
| 10415 | .setup = alc883_medion_wim2160_setup, |
| 10416 | .init_hook = alc_automute_amp, |
| 10417 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10418 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10419 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10420 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10421 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10422 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10423 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10424 | .channel_mode = alc883_3ST_2ch_modes, |
| 10425 | .input_mux = &alc883_capture_source, |
| 10426 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10427 | [ALC883_CLEVO_M540R] = { |
| 10428 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10429 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10430 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10431 | .dac_nids = alc883_dac_nids, |
| 10432 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10433 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10434 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10435 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10436 | .need_dac_fix = 1, |
| 10437 | .input_mux = &alc883_capture_source, |
| 10438 | /* This machine has the hardware HP auto-muting, thus |
| 10439 | * we need no software mute via unsol event |
| 10440 | */ |
| 10441 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10442 | [ALC883_CLEVO_M720] = { |
| 10443 | .mixers = { alc883_clevo_m720_mixer }, |
| 10444 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10445 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10446 | .dac_nids = alc883_dac_nids, |
| 10447 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10448 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10449 | .channel_mode = alc883_3ST_2ch_modes, |
| 10450 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10451 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10452 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10453 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10454 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10455 | [ALC883_LENOVO_101E_2ch] = { |
| 10456 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10457 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10458 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10459 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10460 | .adc_nids = alc883_adc_nids_alt, |
| 10461 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10462 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10463 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10464 | .channel_mode = alc883_3ST_2ch_modes, |
| 10465 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10466 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10467 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10468 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10469 | [ALC883_LENOVO_NB0763] = { |
| 10470 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10471 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10472 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10473 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10474 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10475 | .channel_mode = alc883_3ST_2ch_modes, |
| 10476 | .need_dac_fix = 1, |
| 10477 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10478 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10479 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10480 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10481 | }, |
| 10482 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10483 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10484 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10485 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10486 | .dac_nids = alc883_dac_nids, |
| 10487 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10488 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10489 | .channel_mode = alc883_3ST_6ch_modes, |
| 10490 | .need_dac_fix = 1, |
| 10491 | .input_mux = &alc883_capture_source, |
| 10492 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10493 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10494 | }, |
| 10495 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10496 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10497 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10498 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10499 | .dac_nids = alc883_dac_nids, |
| 10500 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10501 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10502 | .channel_mode = alc883_3ST_2ch_modes, |
| 10503 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10504 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10505 | .setup = alc883_haier_w66_setup, |
| 10506 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10507 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10508 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10509 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10510 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10511 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10512 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10513 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10514 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10515 | .need_dac_fix = 1, |
| 10516 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10517 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10518 | .setup = alc888_3st_hp_setup, |
| 10519 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10520 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10521 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10522 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10523 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10524 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10525 | .dac_nids = alc883_dac_nids, |
| 10526 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10527 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10528 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10529 | .channel_mode = alc883_sixstack_modes, |
| 10530 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10531 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10532 | .setup = alc888_6st_dell_setup, |
| 10533 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10534 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10535 | [ALC883_MITAC] = { |
| 10536 | .mixers = { alc883_mitac_mixer }, |
| 10537 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10538 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10539 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10540 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10541 | .channel_mode = alc883_3ST_2ch_modes, |
| 10542 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10543 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10544 | .setup = alc883_mitac_setup, |
| 10545 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10546 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10547 | [ALC883_FUJITSU_PI2515] = { |
| 10548 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10549 | .init_verbs = { alc883_init_verbs, |
| 10550 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10551 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10552 | .dac_nids = alc883_dac_nids, |
| 10553 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10554 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10555 | .channel_mode = alc883_3ST_2ch_modes, |
| 10556 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10557 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10558 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10559 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10560 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10561 | [ALC888_FUJITSU_XA3530] = { |
| 10562 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10563 | .init_verbs = { alc883_init_verbs, |
| 10564 | alc888_fujitsu_xa3530_verbs }, |
| 10565 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10566 | .dac_nids = alc883_dac_nids, |
| 10567 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10568 | .adc_nids = alc883_adc_nids_rev, |
| 10569 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10570 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10571 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10572 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10573 | .num_mux_defs = |
| 10574 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10575 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10576 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10577 | .setup = alc888_fujitsu_xa3530_setup, |
| 10578 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10579 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10580 | [ALC888_LENOVO_SKY] = { |
| 10581 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10582 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10583 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10584 | .dac_nids = alc883_dac_nids, |
| 10585 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10586 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10587 | .channel_mode = alc883_sixstack_modes, |
| 10588 | .need_dac_fix = 1, |
| 10589 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10590 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10591 | .setup = alc888_lenovo_sky_setup, |
| 10592 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10593 | }, |
| 10594 | [ALC888_ASUS_M90V] = { |
| 10595 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10596 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10597 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10598 | .dac_nids = alc883_dac_nids, |
| 10599 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10600 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10601 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10602 | .channel_mode = alc883_3ST_6ch_modes, |
| 10603 | .need_dac_fix = 1, |
| 10604 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10605 | .unsol_event = alc_sku_unsol_event, |
| 10606 | .setup = alc883_mode2_setup, |
| 10607 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10608 | }, |
| 10609 | [ALC888_ASUS_EEE1601] = { |
| 10610 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10611 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10612 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10613 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10614 | .dac_nids = alc883_dac_nids, |
| 10615 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10616 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10617 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10618 | .channel_mode = alc883_3ST_2ch_modes, |
| 10619 | .need_dac_fix = 1, |
| 10620 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10621 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10622 | .init_hook = alc883_eee1601_inithook, |
| 10623 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10624 | [ALC1200_ASUS_P5Q] = { |
| 10625 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10626 | .init_verbs = { alc883_init_verbs }, |
| 10627 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10628 | .dac_nids = alc883_dac_nids, |
| 10629 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10630 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10631 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10632 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10633 | .channel_mode = alc883_sixstack_modes, |
| 10634 | .input_mux = &alc883_capture_source, |
| 10635 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10636 | [ALC889A_MB31] = { |
| 10637 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10638 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10639 | alc880_gpio1_init_verbs }, |
| 10640 | .adc_nids = alc883_adc_nids, |
| 10641 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10642 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10643 | .dac_nids = alc883_dac_nids, |
| 10644 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10645 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10646 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10647 | .input_mux = &alc889A_mb31_capture_source, |
| 10648 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10649 | .unsol_event = alc889A_mb31_unsol_event, |
| 10650 | .init_hook = alc889A_mb31_automute, |
| 10651 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10652 | [ALC883_SONY_VAIO_TT] = { |
| 10653 | .mixers = { alc883_vaiott_mixer }, |
| 10654 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10655 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10656 | .dac_nids = alc883_dac_nids, |
| 10657 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10658 | .channel_mode = alc883_3ST_2ch_modes, |
| 10659 | .input_mux = &alc883_capture_source, |
| 10660 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10661 | .setup = alc883_vaiott_setup, |
| 10662 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10663 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10664 | }; |
| 10665 | |
| 10666 | |
| 10667 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10668 | * Pin config fixes |
| 10669 | */ |
| 10670 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10671 | PINFIX_ABIT_AW9D_MAX, |
| 10672 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10673 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10674 | }; |
| 10675 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10676 | static const struct alc_fixup alc882_fixups[] = { |
| 10677 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10678 | .pins = (const struct alc_pincfg[]) { |
| 10679 | { 0x15, 0x01080104 }, /* side */ |
| 10680 | { 0x16, 0x01011012 }, /* rear */ |
| 10681 | { 0x17, 0x01016011 }, /* clfe */ |
| 10682 | { } |
| 10683 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10684 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10685 | [PINFIX_PB_M5210] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10686 | .verbs = (const struct hda_verb[]) { |
| 10687 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10688 | {} |
| 10689 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10690 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10691 | [PINFIX_ACER_ASPIRE_7736] = { |
| 10692 | .sku = ALC_FIXUP_SKU_IGNORE, |
| 10693 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10694 | }; |
| 10695 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10696 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10697 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10698 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10699 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10700 | {} |
| 10701 | }; |
| 10702 | |
| 10703 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10704 | * BIOS auto configuration |
| 10705 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10706 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10707 | const struct auto_pin_cfg *cfg) |
| 10708 | { |
| 10709 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10710 | } |
| 10711 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10712 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10713 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10714 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10715 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10716 | int idx; |
| 10717 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10718 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10719 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10720 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10721 | if (dac == 0x25) |
| 10722 | idx = 4; |
| 10723 | else if (dac >= 0x02 && dac <= 0x05) |
| 10724 | idx = dac - 2; |
| 10725 | else |
| 10726 | return; |
| 10727 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10728 | } |
| 10729 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10730 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10731 | { |
| 10732 | struct alc_spec *spec = codec->spec; |
| 10733 | int i; |
| 10734 | |
| 10735 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10736 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10737 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10738 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10739 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10740 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10741 | } |
| 10742 | } |
| 10743 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10744 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10745 | { |
| 10746 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10747 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10748 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10749 | |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10750 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10751 | pin = spec->autocfg.hp_pins[i]; |
| 10752 | if (!pin) |
| 10753 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10754 | dac = spec->multiout.hp_nid; |
| 10755 | if (!dac) |
| 10756 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10757 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10758 | } |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10759 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10760 | pin = spec->autocfg.speaker_pins[i]; |
| 10761 | if (!pin) |
| 10762 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10763 | dac = spec->multiout.extra_out_nid[0]; |
| 10764 | if (!dac) |
| 10765 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10766 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10767 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10768 | } |
| 10769 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10770 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10771 | { |
| 10772 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10773 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10774 | int i; |
| 10775 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10776 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10777 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10778 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10779 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10780 | snd_hda_codec_write(codec, nid, 0, |
| 10781 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10782 | AMP_OUT_MUTE); |
| 10783 | } |
| 10784 | } |
| 10785 | |
| 10786 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10787 | { |
| 10788 | struct alc_spec *spec = codec->spec; |
| 10789 | int c; |
| 10790 | |
| 10791 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10792 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10793 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10794 | unsigned int mux_idx; |
| 10795 | const struct hda_input_mux *imux; |
| 10796 | int conns, mute, idx, item; |
| 10797 | |
| 10798 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10799 | ARRAY_SIZE(conn_list)); |
| 10800 | if (conns < 0) |
| 10801 | continue; |
| 10802 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10803 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10804 | if (!imux->num_items && mux_idx > 0) |
| 10805 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10806 | for (idx = 0; idx < conns; idx++) { |
| 10807 | /* if the current connection is the selected one, |
| 10808 | * unmute it as default - otherwise mute it |
| 10809 | */ |
| 10810 | mute = AMP_IN_MUTE(idx); |
| 10811 | for (item = 0; item < imux->num_items; item++) { |
| 10812 | if (imux->items[item].index == idx) { |
| 10813 | if (spec->cur_mux[c] == item) |
| 10814 | mute = AMP_IN_UNMUTE(idx); |
| 10815 | break; |
| 10816 | } |
| 10817 | } |
| 10818 | /* check if we have a selector or mixer |
| 10819 | * we could check for the widget type instead, but |
| 10820 | * just check for Amp-In presence (in case of mixer |
| 10821 | * without amp-in there is something wrong, this |
| 10822 | * function shouldn't be used or capsrc nid is wrong) |
| 10823 | */ |
| 10824 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10825 | snd_hda_codec_write(codec, nid, 0, |
| 10826 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10827 | mute); |
| 10828 | else if (mute != AMP_IN_MUTE(idx)) |
| 10829 | snd_hda_codec_write(codec, nid, 0, |
| 10830 | AC_VERB_SET_CONNECT_SEL, |
| 10831 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10832 | } |
| 10833 | } |
| 10834 | } |
| 10835 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10836 | /* add mic boosts if needed */ |
| 10837 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10838 | { |
| 10839 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10840 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 10841 | int i, err; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10842 | hda_nid_t nid; |
| 10843 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10844 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10845 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10846 | break; |
| 10847 | nid = cfg->inputs[i].pin; |
| 10848 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 10849 | char label[32]; |
| 10850 | snprintf(label, sizeof(label), "%s Boost", |
| 10851 | hda_get_autocfg_input_label(codec, cfg, i)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10852 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10853 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10854 | if (err < 0) |
| 10855 | return err; |
| 10856 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10857 | } |
| 10858 | return 0; |
| 10859 | } |
| 10860 | |
| 10861 | /* almost identical with ALC880 parser... */ |
| 10862 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10863 | { |
| 10864 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10865 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10866 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10867 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10868 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10869 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10870 | if (err < 0) |
| 10871 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10872 | if (!spec->autocfg.line_outs) |
| 10873 | return 0; /* can't find valid BIOS pin config */ |
| 10874 | |
| 10875 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10876 | if (err < 0) |
| 10877 | return err; |
| 10878 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10879 | if (err < 0) |
| 10880 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10881 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10882 | "Headphone"); |
| 10883 | if (err < 0) |
| 10884 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10885 | err = alc880_auto_create_extra_out(spec, |
| 10886 | spec->autocfg.speaker_pins[0], |
| 10887 | "Speaker"); |
| 10888 | if (err < 0) |
| 10889 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10890 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10891 | if (err < 0) |
| 10892 | return err; |
| 10893 | |
| 10894 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10895 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10896 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10897 | |
| 10898 | if (spec->kctls.list) |
| 10899 | add_mixer(spec, spec->kctls.list); |
| 10900 | |
| 10901 | add_verb(spec, alc883_auto_init_verbs); |
| 10902 | /* if ADC 0x07 is available, initialize it, too */ |
| 10903 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10904 | add_verb(spec, alc882_adc1_init_verbs); |
| 10905 | |
| 10906 | spec->num_mux_defs = 1; |
| 10907 | spec->input_mux = &spec->private_imux[0]; |
| 10908 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10909 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10910 | |
| 10911 | err = alc_auto_add_mic_boost(codec); |
| 10912 | if (err < 0) |
| 10913 | return err; |
| 10914 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10915 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10916 | } |
| 10917 | |
| 10918 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10919 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10920 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10921 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10922 | alc882_auto_init_multi_out(codec); |
| 10923 | alc882_auto_init_hp_out(codec); |
| 10924 | alc882_auto_init_analog_input(codec); |
| 10925 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10926 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10927 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10928 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10929 | } |
| 10930 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10931 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10932 | { |
| 10933 | struct alc_spec *spec; |
| 10934 | int err, board_config; |
| 10935 | |
| 10936 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10937 | if (spec == NULL) |
| 10938 | return -ENOMEM; |
| 10939 | |
| 10940 | codec->spec = spec; |
| 10941 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10942 | switch (codec->vendor_id) { |
| 10943 | case 0x10ec0882: |
| 10944 | case 0x10ec0885: |
| 10945 | break; |
| 10946 | default: |
| 10947 | /* ALC883 and variants */ |
| 10948 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10949 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10950 | } |
| 10951 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10952 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10953 | alc882_models, |
| 10954 | alc882_cfg_tbl); |
| 10955 | |
| 10956 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10957 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10958 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10959 | |
| 10960 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10961 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10962 | codec->chip_name); |
| 10963 | board_config = ALC882_AUTO; |
| 10964 | } |
| 10965 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10966 | if (board_config == ALC882_AUTO) |
| 10967 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10968 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 10969 | alc_auto_parse_customize_define(codec); |
| 10970 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10971 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10972 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10973 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10974 | if (err < 0) { |
| 10975 | alc_free(codec); |
| 10976 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10977 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10978 | printk(KERN_INFO |
| 10979 | "hda_codec: Cannot set up configuration " |
| 10980 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10981 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10982 | } |
| 10983 | } |
| 10984 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10985 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10986 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10987 | if (err < 0) { |
| 10988 | alc_free(codec); |
| 10989 | return err; |
| 10990 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10991 | } |
| 10992 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10993 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10994 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10995 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10996 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10997 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10998 | /* FIXME: setup DAC5 */ |
| 10999 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11000 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11001 | |
| 11002 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11003 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11004 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11005 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11006 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11007 | spec->num_adc_nids = 0; |
| 11008 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11009 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11010 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11011 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11012 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11013 | unsigned int wcap = get_wcaps(codec, nid); |
| 11014 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11015 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11016 | if (wcap != AC_WID_AUD_IN) |
| 11017 | continue; |
| 11018 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11019 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11020 | if (err < 0) |
| 11021 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11022 | err = snd_hda_get_connections(codec, cap, items, |
| 11023 | ARRAY_SIZE(items)); |
| 11024 | if (err < 0) |
| 11025 | continue; |
| 11026 | for (j = 0; j < imux->num_items; j++) |
| 11027 | if (imux->items[j].index >= err) |
| 11028 | break; |
| 11029 | if (j < imux->num_items) |
| 11030 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11031 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11032 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11033 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11034 | spec->adc_nids = spec->private_adc_nids; |
| 11035 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11036 | } |
| 11037 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11038 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11039 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11040 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11041 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11042 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11043 | if (board_config == ALC882_AUTO) |
| 11044 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 11045 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11046 | spec->vmaster_nid = 0x0c; |
| 11047 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11048 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11049 | if (board_config == ALC882_AUTO) |
| 11050 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11051 | |
| 11052 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11053 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11054 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11055 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11056 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11057 | |
| 11058 | return 0; |
| 11059 | } |
| 11060 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11061 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11062 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11063 | * ALC262 support |
| 11064 | */ |
| 11065 | |
| 11066 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11067 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11068 | |
| 11069 | #define alc262_dac_nids alc260_dac_nids |
| 11070 | #define alc262_adc_nids alc882_adc_nids |
| 11071 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11072 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11073 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11074 | |
| 11075 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11076 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11077 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11078 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11079 | /* ADC0 */ |
| 11080 | 0x09 |
| 11081 | }; |
| 11082 | |
| 11083 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11084 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11085 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11087 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11088 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11089 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11090 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11091 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11092 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11093 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11094 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11095 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11096 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11097 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11098 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11099 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11100 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11101 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11102 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11103 | }; |
| 11104 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11105 | /* update HP, line and mono-out pins according to the master switch */ |
| 11106 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11107 | { |
| 11108 | struct alc_spec *spec = codec->spec; |
| 11109 | int val = spec->master_sw; |
| 11110 | |
| 11111 | /* HP & line-out */ |
| 11112 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11113 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11114 | val ? PIN_HP : 0); |
| 11115 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11116 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11117 | val ? PIN_HP : 0); |
| 11118 | /* mono (speaker) depending on the HP jack sense */ |
| 11119 | val = val && !spec->jack_present; |
| 11120 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11121 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11122 | val ? PIN_OUT : 0); |
| 11123 | } |
| 11124 | |
| 11125 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11126 | { |
| 11127 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11128 | |
| 11129 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11130 | alc262_hp_master_update(codec); |
| 11131 | } |
| 11132 | |
| 11133 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11134 | { |
| 11135 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11136 | return; |
| 11137 | alc262_hp_bpc_automute(codec); |
| 11138 | } |
| 11139 | |
| 11140 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11141 | { |
| 11142 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11143 | |
| 11144 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11145 | alc262_hp_master_update(codec); |
| 11146 | } |
| 11147 | |
| 11148 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11149 | unsigned int res) |
| 11150 | { |
| 11151 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11152 | return; |
| 11153 | alc262_hp_wildwest_automute(codec); |
| 11154 | } |
| 11155 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11156 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11157 | |
| 11158 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11159 | struct snd_ctl_elem_value *ucontrol) |
| 11160 | { |
| 11161 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11162 | struct alc_spec *spec = codec->spec; |
| 11163 | int val = !!*ucontrol->value.integer.value; |
| 11164 | |
| 11165 | if (val == spec->master_sw) |
| 11166 | return 0; |
| 11167 | spec->master_sw = val; |
| 11168 | alc262_hp_master_update(codec); |
| 11169 | return 1; |
| 11170 | } |
| 11171 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11172 | #define ALC262_HP_MASTER_SWITCH \ |
| 11173 | { \ |
| 11174 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11175 | .name = "Master Playback Switch", \ |
| 11176 | .info = snd_ctl_boolean_mono_info, \ |
| 11177 | .get = alc262_hp_master_sw_get, \ |
| 11178 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11179 | }, \ |
| 11180 | { \ |
| 11181 | .iface = NID_MAPPING, \ |
| 11182 | .name = "Master Playback Switch", \ |
| 11183 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11184 | } |
| 11185 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11186 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11187 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11188 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11189 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11190 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11191 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11192 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11193 | HDA_OUTPUT), |
| 11194 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11195 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11197 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11198 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11199 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11200 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11201 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11202 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11203 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11204 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11205 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11206 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11207 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11208 | { } /* end */ |
| 11209 | }; |
| 11210 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11211 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11212 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11213 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11214 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11215 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11216 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11217 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11218 | HDA_OUTPUT), |
| 11219 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11220 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11221 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11222 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11223 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11224 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11225 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11226 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11227 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11228 | { } /* end */ |
| 11229 | }; |
| 11230 | |
| 11231 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11232 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11233 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11234 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11235 | { } /* end */ |
| 11236 | }; |
| 11237 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11238 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11239 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11240 | { |
| 11241 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11242 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11243 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11244 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11245 | } |
| 11246 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11247 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11248 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11249 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11250 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11251 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11252 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11254 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11255 | { } /* end */ |
| 11256 | }; |
| 11257 | |
| 11258 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11259 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11261 | |
| 11262 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11263 | { } |
| 11264 | }; |
| 11265 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11266 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11267 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11268 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11269 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11270 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11271 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11272 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11273 | { } /* end */ |
| 11274 | }; |
| 11275 | |
| 11276 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11277 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11278 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11279 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11280 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11281 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11282 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11283 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11284 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11285 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11287 | {} |
| 11288 | }; |
| 11289 | |
| 11290 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11291 | .num_items = 1, |
| 11292 | .items = { |
| 11293 | { "Line", 0x1 }, |
| 11294 | }, |
| 11295 | }; |
| 11296 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11297 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11298 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11299 | { |
| 11300 | struct alc_spec *spec = codec->spec; |
| 11301 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11302 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11303 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11304 | unsigned int mute; |
| 11305 | |
| 11306 | /* HP */ |
| 11307 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11308 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11309 | HDA_AMP_MUTE, mute); |
| 11310 | /* mute internal speaker per jack sense */ |
| 11311 | if (spec->jack_present) |
| 11312 | mute = HDA_AMP_MUTE; |
| 11313 | if (line_nid) |
| 11314 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11315 | HDA_AMP_MUTE, mute); |
| 11316 | if (speaker_nid && speaker_nid != line_nid) |
| 11317 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11318 | HDA_AMP_MUTE, mute); |
| 11319 | } |
| 11320 | |
| 11321 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11322 | |
| 11323 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11324 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11325 | { |
| 11326 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11327 | struct alc_spec *spec = codec->spec; |
| 11328 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11329 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11330 | if (val == spec->master_sw) |
| 11331 | return 0; |
| 11332 | spec->master_sw = val; |
| 11333 | alc262_hippo_master_update(codec); |
| 11334 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11335 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11336 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11337 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11338 | { \ |
| 11339 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11340 | .name = "Master Playback Switch", \ |
| 11341 | .info = snd_ctl_boolean_mono_info, \ |
| 11342 | .get = alc262_hippo_master_sw_get, \ |
| 11343 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11344 | }, \ |
| 11345 | { \ |
| 11346 | .iface = NID_MAPPING, \ |
| 11347 | .name = "Master Playback Switch", \ |
| 11348 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11349 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11350 | } |
| 11351 | |
| 11352 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11353 | ALC262_HIPPO_MASTER_SWITCH, |
| 11354 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11355 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11356 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11357 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11358 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11361 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11362 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11363 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11364 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11365 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11366 | { } /* end */ |
| 11367 | }; |
| 11368 | |
| 11369 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11370 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11371 | ALC262_HIPPO_MASTER_SWITCH, |
| 11372 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11373 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11374 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11375 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11376 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11378 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11379 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11380 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11381 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11382 | { } /* end */ |
| 11383 | }; |
| 11384 | |
| 11385 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11386 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11387 | { |
| 11388 | struct alc_spec *spec = codec->spec; |
| 11389 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11390 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11391 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11392 | alc262_hippo_master_update(codec); |
| 11393 | } |
| 11394 | |
| 11395 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11396 | { |
| 11397 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11398 | return; |
| 11399 | alc262_hippo_automute(codec); |
| 11400 | } |
| 11401 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11402 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11403 | { |
| 11404 | struct alc_spec *spec = codec->spec; |
| 11405 | |
| 11406 | spec->autocfg.hp_pins[0] = 0x15; |
| 11407 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11408 | } |
| 11409 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11410 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11411 | { |
| 11412 | struct alc_spec *spec = codec->spec; |
| 11413 | |
| 11414 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11415 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11416 | } |
| 11417 | |
| 11418 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11419 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11420 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11421 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11423 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11424 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11425 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11426 | { } /* end */ |
| 11427 | }; |
| 11428 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11429 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11430 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11431 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11435 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11436 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11437 | { } /* end */ |
| 11438 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11439 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11440 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11441 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11442 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11443 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11444 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11445 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11446 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11447 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11448 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11449 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11450 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11451 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11452 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11453 | { } /* end */ |
| 11454 | }; |
| 11455 | |
| 11456 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11457 | /* Headphone automute */ |
| 11458 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11459 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11460 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11461 | |
| 11462 | /* P11 AUX_IN, white 4-pin connector */ |
| 11463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11464 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11465 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11466 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11467 | |
| 11468 | {} |
| 11469 | }; |
| 11470 | |
| 11471 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11472 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11473 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11474 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11475 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11476 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11477 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11478 | } |
| 11479 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11480 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11481 | #define alc262_capture_mixer alc882_capture_mixer |
| 11482 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11483 | |
| 11484 | /* |
| 11485 | * generic initialization of ADC, input mixers and output mixers |
| 11486 | */ |
| 11487 | static struct hda_verb alc262_init_verbs[] = { |
| 11488 | /* |
| 11489 | * Unmute ADC0-2 and set the default input to mic-in |
| 11490 | */ |
| 11491 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11492 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11493 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11494 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11495 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11496 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11497 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11498 | /* 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] | 11499 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11500 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11501 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11502 | */ |
| 11503 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11505 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11506 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11507 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11508 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11509 | |
| 11510 | /* |
| 11511 | * Set up output mixers (0x0c - 0x0e) |
| 11512 | */ |
| 11513 | /* set vol=0 to output mixers */ |
| 11514 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11515 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11516 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11517 | /* set up input amps for analog loopback */ |
| 11518 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11520 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11522 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11523 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11524 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11525 | |
| 11526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11527 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11528 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11529 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11530 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11531 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11532 | |
| 11533 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11534 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11535 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11536 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11537 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11538 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11539 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11540 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11541 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11542 | /* FIXME: use matrix-type input source selection */ |
| 11543 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11544 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11545 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11546 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11547 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11548 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11549 | /* Input mixer2 */ |
| 11550 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11551 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11552 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11553 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11554 | /* Input mixer3 */ |
| 11555 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11556 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11557 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11558 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11559 | |
| 11560 | { } |
| 11561 | }; |
| 11562 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11563 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11564 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11565 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11566 | { } |
| 11567 | }; |
| 11568 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11569 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11570 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11571 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11572 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11573 | |
| 11574 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11575 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11576 | {} |
| 11577 | }; |
| 11578 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11579 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11580 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11581 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11582 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11583 | |
| 11584 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11586 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11587 | }; |
| 11588 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11589 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11590 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11591 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11592 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11593 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11594 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11595 | { } /* end */ |
| 11596 | }; |
| 11597 | |
| 11598 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11599 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11600 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11601 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11602 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11603 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11604 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11605 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11606 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11607 | {} |
| 11608 | }; |
| 11609 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11610 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11611 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11612 | struct alc_spec *spec = codec->spec; |
| 11613 | |
| 11614 | spec->autocfg.hp_pins[0] = 0x15; |
| 11615 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11616 | spec->ext_mic.pin = 0x18; |
| 11617 | spec->ext_mic.mux_idx = 0; |
| 11618 | spec->int_mic.pin = 0x12; |
| 11619 | spec->int_mic.mux_idx = 9; |
| 11620 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11621 | } |
| 11622 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11623 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11624 | * nec model |
| 11625 | * 0x15 = headphone |
| 11626 | * 0x16 = internal speaker |
| 11627 | * 0x18 = external mic |
| 11628 | */ |
| 11629 | |
| 11630 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11631 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11632 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11633 | |
| 11634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11636 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11637 | |
| 11638 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11640 | { } /* end */ |
| 11641 | }; |
| 11642 | |
| 11643 | static struct hda_verb alc262_nec_verbs[] = { |
| 11644 | /* Unmute Speaker */ |
| 11645 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11646 | |
| 11647 | /* Headphone */ |
| 11648 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11649 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11650 | |
| 11651 | /* External mic to headphone */ |
| 11652 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11653 | /* External mic to speaker */ |
| 11654 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11655 | {} |
| 11656 | }; |
| 11657 | |
| 11658 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11659 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11660 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11661 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11662 | */ |
| 11663 | |
| 11664 | #define ALC_HP_EVENT 0x37 |
| 11665 | |
| 11666 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11667 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11668 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11669 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11670 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11671 | {} |
| 11672 | }; |
| 11673 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11674 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11675 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11676 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11677 | {} |
| 11678 | }; |
| 11679 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11680 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11681 | /* Front Mic pin: input vref at 50% */ |
| 11682 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11683 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11684 | {} |
| 11685 | }; |
| 11686 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11687 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11688 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11689 | .items = { |
| 11690 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11691 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11692 | { "CD", 0x4 }, |
| 11693 | }, |
| 11694 | }; |
| 11695 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11696 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11697 | .num_items = 5, |
| 11698 | .items = { |
| 11699 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11700 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11701 | { "Line", 0x2 }, |
| 11702 | { "CD", 0x4 }, |
| 11703 | { "AUX IN", 0x6 }, |
| 11704 | }, |
| 11705 | }; |
| 11706 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11707 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11708 | .num_items = 4, |
| 11709 | .items = { |
| 11710 | { "Mic", 0x0 }, |
| 11711 | { "Front Mic", 0x2 }, |
| 11712 | { "Line", 0x1 }, |
| 11713 | { "CD", 0x4 }, |
| 11714 | }, |
| 11715 | }; |
| 11716 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11717 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11718 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11719 | { |
| 11720 | struct alc_spec *spec = codec->spec; |
| 11721 | unsigned int mute; |
| 11722 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11723 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11724 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11725 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11726 | spec->sense_updated = 1; |
| 11727 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11728 | /* unmute internal speaker only if both HPs are unplugged and |
| 11729 | * master switch is on |
| 11730 | */ |
| 11731 | if (spec->jack_present) |
| 11732 | mute = HDA_AMP_MUTE; |
| 11733 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11734 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11735 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11736 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11737 | } |
| 11738 | |
| 11739 | /* unsolicited event for HP jack sensing */ |
| 11740 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11741 | unsigned int res) |
| 11742 | { |
| 11743 | if ((res >> 26) != ALC_HP_EVENT) |
| 11744 | return; |
| 11745 | alc262_fujitsu_automute(codec, 1); |
| 11746 | } |
| 11747 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11748 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11749 | { |
| 11750 | alc262_fujitsu_automute(codec, 1); |
| 11751 | } |
| 11752 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11753 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11754 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11755 | .ops = &snd_hda_bind_vol, |
| 11756 | .values = { |
| 11757 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11758 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11759 | 0 |
| 11760 | }, |
| 11761 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11762 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11763 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11764 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11765 | { |
| 11766 | struct alc_spec *spec = codec->spec; |
| 11767 | unsigned int mute; |
| 11768 | |
| 11769 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11770 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11771 | spec->sense_updated = 1; |
| 11772 | } |
| 11773 | if (spec->jack_present) { |
| 11774 | /* mute internal speaker */ |
| 11775 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11776 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11777 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11778 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11779 | } else { |
| 11780 | /* unmute internal speaker if necessary */ |
| 11781 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11782 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11783 | HDA_AMP_MUTE, mute); |
| 11784 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11785 | HDA_AMP_MUTE, mute); |
| 11786 | } |
| 11787 | } |
| 11788 | |
| 11789 | /* unsolicited event for HP jack sensing */ |
| 11790 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11791 | unsigned int res) |
| 11792 | { |
| 11793 | if ((res >> 26) != ALC_HP_EVENT) |
| 11794 | return; |
| 11795 | alc262_lenovo_3000_automute(codec, 1); |
| 11796 | } |
| 11797 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11798 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11799 | int dir, int idx, long *valp) |
| 11800 | { |
| 11801 | int i, change = 0; |
| 11802 | |
| 11803 | for (i = 0; i < 2; i++, valp++) |
| 11804 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11805 | HDA_AMP_MUTE, |
| 11806 | *valp ? 0 : HDA_AMP_MUTE); |
| 11807 | return change; |
| 11808 | } |
| 11809 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11810 | /* bind hp and internal speaker mute (with plug check) */ |
| 11811 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11812 | struct snd_ctl_elem_value *ucontrol) |
| 11813 | { |
| 11814 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11815 | long *valp = ucontrol->value.integer.value; |
| 11816 | int change; |
| 11817 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11818 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11819 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11820 | if (change) |
| 11821 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11822 | return change; |
| 11823 | } |
| 11824 | |
| 11825 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11826 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11827 | { |
| 11828 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11829 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11830 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11831 | .info = snd_hda_mixer_amp_switch_info, |
| 11832 | .get = snd_hda_mixer_amp_switch_get, |
| 11833 | .put = alc262_fujitsu_master_sw_put, |
| 11834 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11835 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11836 | { |
| 11837 | .iface = NID_MAPPING, |
| 11838 | .name = "Master Playback Switch", |
| 11839 | .private_value = 0x1b, |
| 11840 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11841 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11842 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11843 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11846 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11847 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11848 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11849 | { } /* end */ |
| 11850 | }; |
| 11851 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11852 | /* bind hp and internal speaker mute (with plug check) */ |
| 11853 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11854 | struct snd_ctl_elem_value *ucontrol) |
| 11855 | { |
| 11856 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11857 | long *valp = ucontrol->value.integer.value; |
| 11858 | int change; |
| 11859 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11860 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11861 | if (change) |
| 11862 | alc262_lenovo_3000_automute(codec, 0); |
| 11863 | return change; |
| 11864 | } |
| 11865 | |
| 11866 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11867 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11868 | { |
| 11869 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11870 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11871 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11872 | .info = snd_hda_mixer_amp_switch_info, |
| 11873 | .get = snd_hda_mixer_amp_switch_get, |
| 11874 | .put = alc262_lenovo_3000_master_sw_put, |
| 11875 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11876 | }, |
| 11877 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11878 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11879 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11880 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11882 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11883 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11884 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11885 | { } /* end */ |
| 11886 | }; |
| 11887 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11888 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11889 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11890 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11891 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11893 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11894 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11895 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11896 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11897 | { } /* end */ |
| 11898 | }; |
| 11899 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11900 | /* additional init verbs for Benq laptops */ |
| 11901 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11902 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11903 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11904 | {} |
| 11905 | }; |
| 11906 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11907 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11908 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11909 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11910 | |
| 11911 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11912 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11913 | {} |
| 11914 | }; |
| 11915 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11916 | /* Samsung Q1 Ultra Vista model setup */ |
| 11917 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11918 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11919 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11920 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11921 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11922 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11923 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11924 | { } /* end */ |
| 11925 | }; |
| 11926 | |
| 11927 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11928 | /* output mixer */ |
| 11929 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11931 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11932 | /* speaker */ |
| 11933 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11934 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11935 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11936 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11937 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11938 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11939 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11941 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11942 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11943 | /* internal mic */ |
| 11944 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11945 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11946 | /* ADC, choose mic */ |
| 11947 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11948 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11949 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11950 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11951 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11952 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11953 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11954 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11955 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11956 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11957 | {} |
| 11958 | }; |
| 11959 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11960 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11961 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11962 | { |
| 11963 | struct alc_spec *spec = codec->spec; |
| 11964 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11965 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11966 | mute = 0; |
| 11967 | /* auto-mute only when HP is used as HP */ |
| 11968 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11969 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11970 | if (spec->jack_present) |
| 11971 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11972 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11973 | /* mute/unmute internal speaker */ |
| 11974 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11975 | HDA_AMP_MUTE, mute); |
| 11976 | /* mute/unmute HP */ |
| 11977 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11978 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11979 | } |
| 11980 | |
| 11981 | /* unsolicited event for HP jack sensing */ |
| 11982 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11983 | unsigned int res) |
| 11984 | { |
| 11985 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11986 | return; |
| 11987 | alc262_ultra_automute(codec); |
| 11988 | } |
| 11989 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11990 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11991 | .num_items = 2, |
| 11992 | .items = { |
| 11993 | { "Mic", 0x1 }, |
| 11994 | { "Headphone", 0x7 }, |
| 11995 | }, |
| 11996 | }; |
| 11997 | |
| 11998 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11999 | struct snd_ctl_elem_value *ucontrol) |
| 12000 | { |
| 12001 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12002 | struct alc_spec *spec = codec->spec; |
| 12003 | int ret; |
| 12004 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12005 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12006 | if (!ret) |
| 12007 | return 0; |
| 12008 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12009 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12010 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12011 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12012 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12013 | return ret; |
| 12014 | } |
| 12015 | |
| 12016 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12017 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12018 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12019 | { |
| 12020 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12021 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12022 | .info = alc_mux_enum_info, |
| 12023 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12024 | .put = alc262_ultra_mux_enum_put, |
| 12025 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12026 | { |
| 12027 | .iface = NID_MAPPING, |
| 12028 | .name = "Capture Source", |
| 12029 | .private_value = 0x15, |
| 12030 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12031 | { } /* end */ |
| 12032 | }; |
| 12033 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12034 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12035 | * and thus it's bound with a different mixer. |
| 12036 | * This function returns which mixer amp should be used. |
| 12037 | */ |
| 12038 | static int alc262_check_volbit(hda_nid_t nid) |
| 12039 | { |
| 12040 | if (!nid) |
| 12041 | return 0; |
| 12042 | else if (nid == 0x16) |
| 12043 | return 2; |
| 12044 | else |
| 12045 | return 1; |
| 12046 | } |
| 12047 | |
| 12048 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12049 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12050 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12051 | unsigned long val; |
| 12052 | int vbit; |
| 12053 | |
| 12054 | vbit = alc262_check_volbit(nid); |
| 12055 | if (!vbit) |
| 12056 | return 0; |
| 12057 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12058 | return 0; |
| 12059 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12060 | if (vbit == 2) |
| 12061 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12062 | else |
| 12063 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12064 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12065 | } |
| 12066 | |
| 12067 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12068 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12069 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12070 | unsigned long val; |
| 12071 | |
| 12072 | if (!nid) |
| 12073 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12074 | if (nid == 0x16) |
| 12075 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12076 | else |
| 12077 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12078 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12079 | } |
| 12080 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12081 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12082 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12083 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12084 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12085 | const char *pfx; |
| 12086 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12087 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12088 | |
| 12089 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12090 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12091 | spec->multiout.dac_nids[0] = 2; |
| 12092 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12093 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 12094 | pfx = "Master"; |
| 12095 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12096 | pfx = "Speaker"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12097 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) |
| 12098 | pfx = "Headphone"; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12099 | else |
| 12100 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12101 | for (i = 0; i < 2; i++) { |
| 12102 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12103 | if (err < 0) |
| 12104 | return err; |
| 12105 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12106 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12107 | "Speaker", i); |
| 12108 | if (err < 0) |
| 12109 | return err; |
| 12110 | } |
| 12111 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12112 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12113 | "Headphone", i); |
| 12114 | if (err < 0) |
| 12115 | return err; |
| 12116 | } |
| 12117 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12118 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12119 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12120 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12121 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12122 | if (vbits == 1 || vbits == 2) |
| 12123 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12124 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12125 | for (i = 0; i < 2; i++) { |
| 12126 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12127 | &vbits, i); |
| 12128 | if (err < 0) |
| 12129 | return err; |
| 12130 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12131 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12132 | "Speaker", &vbits, i); |
| 12133 | if (err < 0) |
| 12134 | return err; |
| 12135 | } |
| 12136 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12137 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12138 | "Headphone", &vbits, i); |
| 12139 | if (err < 0) |
| 12140 | return err; |
| 12141 | } |
| 12142 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12143 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12144 | } |
| 12145 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12146 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12147 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12148 | |
| 12149 | /* |
| 12150 | * generic initialization of ADC, input mixers and output mixers |
| 12151 | */ |
| 12152 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12153 | /* |
| 12154 | * Unmute ADC0-2 and set the default input to mic-in |
| 12155 | */ |
| 12156 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12158 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12159 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12160 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12161 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12162 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12163 | /* 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] | 12164 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12165 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12166 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12167 | */ |
| 12168 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12169 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12170 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12171 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12174 | |
| 12175 | /* |
| 12176 | * Set up output mixers (0x0c - 0x0f) |
| 12177 | */ |
| 12178 | /* set vol=0 to output mixers */ |
| 12179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12180 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12181 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12182 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12183 | /* set up input amps for analog loopback */ |
| 12184 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12185 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12186 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12187 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12188 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12189 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12190 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12191 | |
| 12192 | /* FIXME: use matrix-type input source selection */ |
| 12193 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12194 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12197 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12198 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12199 | /* Input mixer2 */ |
| 12200 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12201 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12202 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12203 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12204 | /* Input mixer3 */ |
| 12205 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12206 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12207 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12208 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12209 | |
| 12210 | { } |
| 12211 | }; |
| 12212 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12213 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12214 | /* |
| 12215 | * Unmute ADC0-2 and set the default input to mic-in |
| 12216 | */ |
| 12217 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12218 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12219 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12220 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12221 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12222 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12223 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12224 | /* 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] | 12225 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12226 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12227 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12228 | */ |
| 12229 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12230 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12231 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12232 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12233 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12234 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12235 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12236 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12237 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12238 | /* |
| 12239 | * Set up output mixers (0x0c - 0x0e) |
| 12240 | */ |
| 12241 | /* set vol=0 to output mixers */ |
| 12242 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12243 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12244 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12245 | |
| 12246 | /* set up input amps for analog loopback */ |
| 12247 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12248 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12250 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12251 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12252 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12253 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12254 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12255 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12257 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12258 | |
| 12259 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12260 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12261 | |
| 12262 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12263 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12264 | |
| 12265 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12266 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12267 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12268 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12269 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12270 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12271 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12272 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12273 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12274 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12275 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12276 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12277 | |
| 12278 | |
| 12279 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12280 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12281 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12282 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12283 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12284 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12285 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12287 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12288 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12290 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12291 | /* Input mixer2 */ |
| 12292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12293 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12295 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12297 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12299 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12300 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12301 | /* Input mixer3 */ |
| 12302 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12303 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12304 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12305 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12306 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12307 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12308 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12309 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12311 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12312 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12313 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12314 | { } |
| 12315 | }; |
| 12316 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12317 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12318 | /* |
| 12319 | * Unmute ADC0-2 and set the default input to mic-in |
| 12320 | */ |
| 12321 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12322 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12323 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12324 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12325 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12326 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12327 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12328 | /* 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] | 12329 | * mixer widget |
| 12330 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12331 | * panel mic (mic 2) |
| 12332 | */ |
| 12333 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12334 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12336 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12337 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12338 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12339 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12340 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12341 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12342 | /* |
| 12343 | * Set up output mixers (0x0c - 0x0e) |
| 12344 | */ |
| 12345 | /* set vol=0 to output mixers */ |
| 12346 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12347 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12349 | |
| 12350 | /* set up input amps for analog loopback */ |
| 12351 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12352 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12353 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12354 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12355 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12356 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12357 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12358 | |
| 12359 | |
| 12360 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12361 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12362 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12363 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12364 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12365 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12366 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12367 | |
| 12368 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12370 | |
| 12371 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12372 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12373 | |
| 12374 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12375 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12376 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12377 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12378 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12379 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12380 | |
| 12381 | /* FIXME: use matrix-type input source selection */ |
| 12382 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12383 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12384 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12385 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12386 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12387 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12389 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12390 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12391 | /* Input mixer2 */ |
| 12392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12394 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12395 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12396 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12397 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12398 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12399 | /* Input mixer3 */ |
| 12400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12402 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12403 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12404 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12405 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12406 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12407 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12408 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12409 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12410 | { } |
| 12411 | }; |
| 12412 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12413 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12414 | |
| 12415 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12416 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12417 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12418 | |
| 12419 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12420 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12421 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12422 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12423 | |
| 12424 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12425 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12426 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12427 | {} |
| 12428 | }; |
| 12429 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12430 | /* |
| 12431 | * Pin config fixes |
| 12432 | */ |
| 12433 | enum { |
| 12434 | PINFIX_FSC_H270, |
| 12435 | }; |
| 12436 | |
| 12437 | static const struct alc_fixup alc262_fixups[] = { |
| 12438 | [PINFIX_FSC_H270] = { |
| 12439 | .pins = (const struct alc_pincfg[]) { |
| 12440 | { 0x14, 0x99130110 }, /* speaker */ |
| 12441 | { 0x15, 0x0221142f }, /* front HP */ |
| 12442 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12443 | { } |
| 12444 | } |
| 12445 | }, |
| 12446 | [PINFIX_PB_M5210] = { |
| 12447 | .verbs = (const struct hda_verb[]) { |
| 12448 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 12449 | {} |
| 12450 | } |
| 12451 | }, |
| 12452 | }; |
| 12453 | |
| 12454 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12455 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12456 | {} |
| 12457 | }; |
| 12458 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12459 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12460 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12461 | #define alc262_loopbacks alc880_loopbacks |
| 12462 | #endif |
| 12463 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12464 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12465 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12466 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12467 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12468 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12469 | |
| 12470 | /* |
| 12471 | * BIOS auto configuration |
| 12472 | */ |
| 12473 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12474 | { |
| 12475 | struct alc_spec *spec = codec->spec; |
| 12476 | int err; |
| 12477 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12478 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12479 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12480 | alc262_ignore); |
| 12481 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12482 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12483 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12484 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12485 | spec->multiout.max_channels = 2; |
| 12486 | spec->no_analog = 1; |
| 12487 | goto dig_only; |
| 12488 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12489 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12490 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12491 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12492 | if (err < 0) |
| 12493 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12494 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12495 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12496 | return err; |
| 12497 | |
| 12498 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12499 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12500 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12501 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12502 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12503 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12504 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12505 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12506 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12507 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12508 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12509 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12510 | err = alc_auto_add_mic_boost(codec); |
| 12511 | if (err < 0) |
| 12512 | return err; |
| 12513 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12514 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12515 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12516 | return 1; |
| 12517 | } |
| 12518 | |
| 12519 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12520 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12521 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12522 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12523 | |
| 12524 | |
| 12525 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12526 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12527 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12528 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12529 | alc262_auto_init_multi_out(codec); |
| 12530 | alc262_auto_init_hp_out(codec); |
| 12531 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12532 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12533 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12534 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12535 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12536 | } |
| 12537 | |
| 12538 | /* |
| 12539 | * configuration and preset |
| 12540 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12541 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12542 | [ALC262_BASIC] = "basic", |
| 12543 | [ALC262_HIPPO] = "hippo", |
| 12544 | [ALC262_HIPPO_1] = "hippo_1", |
| 12545 | [ALC262_FUJITSU] = "fujitsu", |
| 12546 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12547 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12548 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12549 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12550 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12551 | [ALC262_BENQ_T31] = "benq-t31", |
| 12552 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12553 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12554 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12555 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12556 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12557 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12558 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12559 | [ALC262_AUTO] = "auto", |
| 12560 | }; |
| 12561 | |
| 12562 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12563 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12564 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12565 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12566 | ALC262_HP_BPC), |
| 12567 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12568 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12569 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12570 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12571 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12572 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12573 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12574 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12575 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12576 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12577 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12578 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12579 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12580 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12581 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12582 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12583 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12584 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12585 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12586 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12587 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12588 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12589 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12590 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12591 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12592 | #if 0 /* disable the quirk since model=auto works better in recent versions */ |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 12593 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12594 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12595 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12596 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12597 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12598 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12599 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12600 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12601 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12602 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12603 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12604 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12605 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12606 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12607 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12608 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12609 | {} |
| 12610 | }; |
| 12611 | |
| 12612 | static struct alc_config_preset alc262_presets[] = { |
| 12613 | [ALC262_BASIC] = { |
| 12614 | .mixers = { alc262_base_mixer }, |
| 12615 | .init_verbs = { alc262_init_verbs }, |
| 12616 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12617 | .dac_nids = alc262_dac_nids, |
| 12618 | .hp_nid = 0x03, |
| 12619 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12620 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12621 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12622 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12623 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12624 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12625 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12626 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12627 | .dac_nids = alc262_dac_nids, |
| 12628 | .hp_nid = 0x03, |
| 12629 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12630 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12631 | .channel_mode = alc262_modes, |
| 12632 | .input_mux = &alc262_capture_source, |
| 12633 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12634 | .setup = alc262_hippo_setup, |
| 12635 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12636 | }, |
| 12637 | [ALC262_HIPPO_1] = { |
| 12638 | .mixers = { alc262_hippo1_mixer }, |
| 12639 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12640 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12641 | .dac_nids = alc262_dac_nids, |
| 12642 | .hp_nid = 0x02, |
| 12643 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12644 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12645 | .channel_mode = alc262_modes, |
| 12646 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12647 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12648 | .setup = alc262_hippo1_setup, |
| 12649 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12650 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12651 | [ALC262_FUJITSU] = { |
| 12652 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12653 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12654 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12655 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12656 | .dac_nids = alc262_dac_nids, |
| 12657 | .hp_nid = 0x03, |
| 12658 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12659 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12660 | .channel_mode = alc262_modes, |
| 12661 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12662 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12663 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12664 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12665 | [ALC262_HP_BPC] = { |
| 12666 | .mixers = { alc262_HP_BPC_mixer }, |
| 12667 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12668 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12669 | .dac_nids = alc262_dac_nids, |
| 12670 | .hp_nid = 0x03, |
| 12671 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12672 | .channel_mode = alc262_modes, |
| 12673 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12674 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12675 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12676 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12677 | [ALC262_HP_BPC_D7000_WF] = { |
| 12678 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12679 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12680 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12681 | .dac_nids = alc262_dac_nids, |
| 12682 | .hp_nid = 0x03, |
| 12683 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12684 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12685 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12686 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12687 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12688 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12689 | [ALC262_HP_BPC_D7000_WL] = { |
| 12690 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12691 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12692 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12693 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12694 | .dac_nids = alc262_dac_nids, |
| 12695 | .hp_nid = 0x03, |
| 12696 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12697 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12698 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12699 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12700 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12701 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12702 | [ALC262_HP_TC_T5735] = { |
| 12703 | .mixers = { alc262_hp_t5735_mixer }, |
| 12704 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12705 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12706 | .dac_nids = alc262_dac_nids, |
| 12707 | .hp_nid = 0x03, |
| 12708 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12709 | .channel_mode = alc262_modes, |
| 12710 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12711 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12712 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12713 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12714 | }, |
| 12715 | [ALC262_HP_RP5700] = { |
| 12716 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12717 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12718 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12719 | .dac_nids = alc262_dac_nids, |
| 12720 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12721 | .channel_mode = alc262_modes, |
| 12722 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12723 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12724 | [ALC262_BENQ_ED8] = { |
| 12725 | .mixers = { alc262_base_mixer }, |
| 12726 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12727 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12728 | .dac_nids = alc262_dac_nids, |
| 12729 | .hp_nid = 0x03, |
| 12730 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12731 | .channel_mode = alc262_modes, |
| 12732 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12733 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12734 | [ALC262_SONY_ASSAMD] = { |
| 12735 | .mixers = { alc262_sony_mixer }, |
| 12736 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12737 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12738 | .dac_nids = alc262_dac_nids, |
| 12739 | .hp_nid = 0x02, |
| 12740 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12741 | .channel_mode = alc262_modes, |
| 12742 | .input_mux = &alc262_capture_source, |
| 12743 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12744 | .setup = alc262_hippo_setup, |
| 12745 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12746 | }, |
| 12747 | [ALC262_BENQ_T31] = { |
| 12748 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12749 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12750 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12751 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12752 | .dac_nids = alc262_dac_nids, |
| 12753 | .hp_nid = 0x03, |
| 12754 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12755 | .channel_mode = alc262_modes, |
| 12756 | .input_mux = &alc262_capture_source, |
| 12757 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12758 | .setup = alc262_hippo_setup, |
| 12759 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12760 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12761 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12762 | .mixers = { alc262_ultra_mixer }, |
| 12763 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12764 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12765 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12766 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12767 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12768 | .channel_mode = alc262_modes, |
| 12769 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12770 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12771 | .capsrc_nids = alc262_capsrc_nids, |
| 12772 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12773 | .unsol_event = alc262_ultra_unsol_event, |
| 12774 | .init_hook = alc262_ultra_automute, |
| 12775 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12776 | [ALC262_LENOVO_3000] = { |
| 12777 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12778 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12779 | alc262_lenovo_3000_unsol_verbs, |
| 12780 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12781 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12782 | .dac_nids = alc262_dac_nids, |
| 12783 | .hp_nid = 0x03, |
| 12784 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12785 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12786 | .channel_mode = alc262_modes, |
| 12787 | .input_mux = &alc262_fujitsu_capture_source, |
| 12788 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12789 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12790 | [ALC262_NEC] = { |
| 12791 | .mixers = { alc262_nec_mixer }, |
| 12792 | .init_verbs = { alc262_nec_verbs }, |
| 12793 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12794 | .dac_nids = alc262_dac_nids, |
| 12795 | .hp_nid = 0x03, |
| 12796 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12797 | .channel_mode = alc262_modes, |
| 12798 | .input_mux = &alc262_capture_source, |
| 12799 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12800 | [ALC262_TOSHIBA_S06] = { |
| 12801 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12802 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12803 | alc262_eapd_verbs }, |
| 12804 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12805 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12806 | .dac_nids = alc262_dac_nids, |
| 12807 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12808 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12809 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12810 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12811 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12812 | .unsol_event = alc_sku_unsol_event, |
| 12813 | .setup = alc262_toshiba_s06_setup, |
| 12814 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12815 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12816 | [ALC262_TOSHIBA_RX1] = { |
| 12817 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12818 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12819 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12820 | .dac_nids = alc262_dac_nids, |
| 12821 | .hp_nid = 0x03, |
| 12822 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12823 | .channel_mode = alc262_modes, |
| 12824 | .input_mux = &alc262_capture_source, |
| 12825 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12826 | .setup = alc262_hippo_setup, |
| 12827 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12828 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12829 | [ALC262_TYAN] = { |
| 12830 | .mixers = { alc262_tyan_mixer }, |
| 12831 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12832 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12833 | .dac_nids = alc262_dac_nids, |
| 12834 | .hp_nid = 0x02, |
| 12835 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12836 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12837 | .channel_mode = alc262_modes, |
| 12838 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12839 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12840 | .setup = alc262_tyan_setup, |
| 12841 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12842 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12843 | }; |
| 12844 | |
| 12845 | static int patch_alc262(struct hda_codec *codec) |
| 12846 | { |
| 12847 | struct alc_spec *spec; |
| 12848 | int board_config; |
| 12849 | int err; |
| 12850 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12851 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12852 | if (spec == NULL) |
| 12853 | return -ENOMEM; |
| 12854 | |
| 12855 | codec->spec = spec; |
| 12856 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12857 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12858 | * under-run |
| 12859 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12860 | { |
| 12861 | int tmp; |
| 12862 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12863 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12864 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12865 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12866 | } |
| 12867 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12868 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12869 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12870 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12871 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12872 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12873 | alc262_models, |
| 12874 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12875 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12876 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12877 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12878 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12879 | board_config = ALC262_AUTO; |
| 12880 | } |
| 12881 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12882 | if (board_config == ALC262_AUTO) |
| 12883 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); |
| 12884 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12885 | if (board_config == ALC262_AUTO) { |
| 12886 | /* automatic parse from the BIOS config */ |
| 12887 | err = alc262_parse_auto_config(codec); |
| 12888 | if (err < 0) { |
| 12889 | alc_free(codec); |
| 12890 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12891 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12892 | printk(KERN_INFO |
| 12893 | "hda_codec: Cannot set up configuration " |
| 12894 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12895 | board_config = ALC262_BASIC; |
| 12896 | } |
| 12897 | } |
| 12898 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12899 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12900 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12901 | if (err < 0) { |
| 12902 | alc_free(codec); |
| 12903 | return err; |
| 12904 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12905 | } |
| 12906 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12907 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12908 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12909 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12910 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12911 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12913 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12914 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12915 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12916 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12917 | int i; |
| 12918 | /* check whether the digital-mic has to be supported */ |
| 12919 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12920 | if (spec->input_mux->items[i].index >= 9) |
| 12921 | break; |
| 12922 | } |
| 12923 | if (i < spec->input_mux->num_items) { |
| 12924 | /* use only ADC0 */ |
| 12925 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12926 | spec->num_adc_nids = 1; |
| 12927 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12928 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12929 | /* all analog inputs */ |
| 12930 | /* check whether NID 0x07 is valid */ |
| 12931 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12932 | |
| 12933 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12934 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12935 | if (wcap != AC_WID_AUD_IN) { |
| 12936 | spec->adc_nids = alc262_adc_nids_alt; |
| 12937 | spec->num_adc_nids = |
| 12938 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12939 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12940 | } else { |
| 12941 | spec->adc_nids = alc262_adc_nids; |
| 12942 | spec->num_adc_nids = |
| 12943 | ARRAY_SIZE(alc262_adc_nids); |
| 12944 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12945 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12946 | } |
| 12947 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12948 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12949 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12950 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12951 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12952 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12953 | if (board_config == ALC262_AUTO) |
| 12954 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); |
| 12955 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12956 | spec->vmaster_nid = 0x0c; |
| 12957 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12958 | codec->patch_ops = alc_patch_ops; |
| 12959 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12960 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 12961 | |
| 12962 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12963 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12964 | if (!spec->loopback.amplist) |
| 12965 | spec->loopback.amplist = alc262_loopbacks; |
| 12966 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12967 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12968 | return 0; |
| 12969 | } |
| 12970 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12971 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12972 | * ALC268 channel source setting (2 channel) |
| 12973 | */ |
| 12974 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12975 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12976 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12977 | static hda_nid_t alc268_dac_nids[2] = { |
| 12978 | /* front, hp */ |
| 12979 | 0x02, 0x03 |
| 12980 | }; |
| 12981 | |
| 12982 | static hda_nid_t alc268_adc_nids[2] = { |
| 12983 | /* ADC0-1 */ |
| 12984 | 0x08, 0x07 |
| 12985 | }; |
| 12986 | |
| 12987 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12988 | /* ADC0 */ |
| 12989 | 0x08 |
| 12990 | }; |
| 12991 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12992 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12993 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12994 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12995 | /* output mixer control */ |
| 12996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12997 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12998 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12999 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 13000 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13001 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13002 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13003 | { } |
| 13004 | }; |
| 13005 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13006 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13007 | /* output mixer control */ |
| 13008 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13009 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13010 | ALC262_HIPPO_MASTER_SWITCH, |
| 13011 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13012 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13013 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 13014 | { } |
| 13015 | }; |
| 13016 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13017 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13018 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13019 | .ops = &snd_hda_bind_sw, |
| 13020 | .values = { |
| 13021 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13022 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13023 | 0 |
| 13024 | }, |
| 13025 | }; |
| 13026 | |
| 13027 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13028 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13029 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13030 | { } |
| 13031 | }; |
| 13032 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13033 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13034 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13035 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13036 | { } |
| 13037 | }; |
| 13038 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13039 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13040 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13041 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13042 | { } /* end */ |
| 13043 | }; |
| 13044 | |
| 13045 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13046 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13047 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13048 | .ops = &snd_hda_bind_vol, |
| 13049 | .values = { |
| 13050 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13051 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13052 | 0 |
| 13053 | }, |
| 13054 | }; |
| 13055 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13056 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13057 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13058 | { |
| 13059 | struct alc_spec *spec = codec->spec; |
| 13060 | unsigned int mute; |
| 13061 | |
| 13062 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13063 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13064 | spec->sense_updated = 1; |
| 13065 | } |
| 13066 | if (spec->jack_present) |
| 13067 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13068 | else /* unmute internal speaker if necessary */ |
| 13069 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13070 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13071 | HDA_AMP_MUTE, mute); |
| 13072 | } |
| 13073 | |
| 13074 | |
| 13075 | /* bind hp and internal speaker mute (with plug check) */ |
| 13076 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13077 | struct snd_ctl_elem_value *ucontrol) |
| 13078 | { |
| 13079 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13080 | long *valp = ucontrol->value.integer.value; |
| 13081 | int change; |
| 13082 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13083 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13084 | if (change) |
| 13085 | alc268_acer_automute(codec, 0); |
| 13086 | return change; |
| 13087 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13088 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13089 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13090 | /* output mixer control */ |
| 13091 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13092 | { |
| 13093 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13094 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13095 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13096 | .info = snd_hda_mixer_amp_switch_info, |
| 13097 | .get = snd_hda_mixer_amp_switch_get, |
| 13098 | .put = alc268_acer_master_sw_put, |
| 13099 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13100 | }, |
| 13101 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13102 | { } |
| 13103 | }; |
| 13104 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13105 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13106 | /* output mixer control */ |
| 13107 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13108 | { |
| 13109 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13110 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13111 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13112 | .info = snd_hda_mixer_amp_switch_info, |
| 13113 | .get = snd_hda_mixer_amp_switch_get, |
| 13114 | .put = alc268_acer_master_sw_put, |
| 13115 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13116 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 13117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13118 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13119 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13120 | { } |
| 13121 | }; |
| 13122 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13123 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13124 | /* output mixer control */ |
| 13125 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13126 | { |
| 13127 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13128 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13129 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13130 | .info = snd_hda_mixer_amp_switch_info, |
| 13131 | .get = snd_hda_mixer_amp_switch_get, |
| 13132 | .put = alc268_acer_master_sw_put, |
| 13133 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13134 | }, |
| 13135 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13136 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 13137 | { } |
| 13138 | }; |
| 13139 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13140 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13141 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13143 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13144 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13145 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13146 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13147 | { } |
| 13148 | }; |
| 13149 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13150 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13151 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13152 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13153 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13154 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13155 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13156 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13157 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13158 | { } |
| 13159 | }; |
| 13160 | |
| 13161 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13162 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13163 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13164 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13165 | |
| 13166 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13167 | unsigned int res) |
| 13168 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13169 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13170 | return; |
| 13171 | alc268_acer_automute(codec, 1); |
| 13172 | } |
| 13173 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13174 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13175 | { |
| 13176 | alc268_acer_automute(codec, 1); |
| 13177 | } |
| 13178 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13179 | /* toggle speaker-output according to the hp-jack state */ |
| 13180 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13181 | { |
| 13182 | unsigned int present; |
| 13183 | unsigned char bits; |
| 13184 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13185 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13186 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13187 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13188 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13189 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13190 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13191 | } |
| 13192 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13193 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13194 | unsigned int res) |
| 13195 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13196 | switch (res >> 26) { |
| 13197 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13198 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13199 | break; |
| 13200 | case ALC880_MIC_EVENT: |
| 13201 | alc_mic_automute(codec); |
| 13202 | break; |
| 13203 | } |
| 13204 | } |
| 13205 | |
| 13206 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13207 | { |
| 13208 | struct alc_spec *spec = codec->spec; |
| 13209 | spec->ext_mic.pin = 0x18; |
| 13210 | spec->ext_mic.mux_idx = 0; |
| 13211 | spec->int_mic.pin = 0x12; |
| 13212 | spec->int_mic.mux_idx = 6; |
| 13213 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13214 | } |
| 13215 | |
| 13216 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13217 | { |
| 13218 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13219 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13220 | } |
| 13221 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13222 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13223 | /* output mixer control */ |
| 13224 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13225 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13226 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13227 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13228 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13229 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13230 | { } |
| 13231 | }; |
| 13232 | |
| 13233 | static struct hda_verb alc268_dell_verbs[] = { |
| 13234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13236 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13237 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13238 | { } |
| 13239 | }; |
| 13240 | |
| 13241 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13242 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13243 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13244 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13245 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13246 | spec->autocfg.hp_pins[0] = 0x15; |
| 13247 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13248 | spec->ext_mic.pin = 0x18; |
| 13249 | spec->ext_mic.mux_idx = 0; |
| 13250 | spec->int_mic.pin = 0x19; |
| 13251 | spec->int_mic.mux_idx = 1; |
| 13252 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13253 | } |
| 13254 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13255 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13256 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13257 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13258 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13259 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13260 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13261 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13262 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13263 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13264 | { } |
| 13265 | }; |
| 13266 | |
| 13267 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13268 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13269 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13270 | { } |
| 13271 | }; |
| 13272 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13273 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13274 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13275 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13276 | spec->autocfg.hp_pins[0] = 0x15; |
| 13277 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13278 | spec->ext_mic.pin = 0x18; |
| 13279 | spec->ext_mic.mux_idx = 0; |
| 13280 | spec->int_mic.pin = 0x19; |
| 13281 | spec->int_mic.mux_idx = 1; |
| 13282 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13283 | } |
| 13284 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13285 | /* |
| 13286 | * generic initialization of ADC, input mixers and output mixers |
| 13287 | */ |
| 13288 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13289 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13290 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13291 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13292 | |
| 13293 | /* |
| 13294 | * Set up output mixers (0x0c - 0x0e) |
| 13295 | */ |
| 13296 | /* set vol=0 to output mixers */ |
| 13297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13298 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13299 | |
| 13300 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13301 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13302 | |
| 13303 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13304 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13305 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13306 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13307 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13308 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13309 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13310 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13311 | |
| 13312 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13313 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13314 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13315 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13316 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13317 | |
| 13318 | /* set PCBEEP vol = 0, mute connections */ |
| 13319 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13320 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13321 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13322 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13323 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13324 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13325 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13327 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13328 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13329 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13330 | { } |
| 13331 | }; |
| 13332 | |
| 13333 | /* |
| 13334 | * generic initialization of ADC, input mixers and output mixers |
| 13335 | */ |
| 13336 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13337 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13338 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13339 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13340 | |
| 13341 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13342 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13343 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13344 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13345 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13346 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13348 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13349 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13350 | |
| 13351 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13352 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13353 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13354 | /* set PCBEEP vol = 0, mute connections */ |
| 13355 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13356 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13357 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13358 | |
| 13359 | { } |
| 13360 | }; |
| 13361 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13362 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13363 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13364 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13365 | { } /* end */ |
| 13366 | }; |
| 13367 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13368 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13369 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13370 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13371 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13372 | { } /* end */ |
| 13373 | }; |
| 13374 | |
| 13375 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13376 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13377 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13378 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13379 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13380 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13381 | { } /* end */ |
| 13382 | }; |
| 13383 | |
| 13384 | static struct hda_input_mux alc268_capture_source = { |
| 13385 | .num_items = 4, |
| 13386 | .items = { |
| 13387 | { "Mic", 0x0 }, |
| 13388 | { "Front Mic", 0x1 }, |
| 13389 | { "Line", 0x2 }, |
| 13390 | { "CD", 0x3 }, |
| 13391 | }, |
| 13392 | }; |
| 13393 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13394 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13395 | .num_items = 3, |
| 13396 | .items = { |
| 13397 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13398 | { "Internal Mic", 0x1 }, |
| 13399 | { "Line", 0x2 }, |
| 13400 | }, |
| 13401 | }; |
| 13402 | |
| 13403 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13404 | .num_items = 3, |
| 13405 | .items = { |
| 13406 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13407 | { "Internal Mic", 0x6 }, |
| 13408 | { "Line", 0x2 }, |
| 13409 | }, |
| 13410 | }; |
| 13411 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13412 | #ifdef CONFIG_SND_DEBUG |
| 13413 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13414 | /* Volume widgets */ |
| 13415 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13416 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13417 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13418 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13419 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13420 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13421 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13422 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13423 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13424 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13425 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13426 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13427 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13428 | /* The below appears problematic on some hardwares */ |
| 13429 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13430 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13431 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13432 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13433 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13434 | |
| 13435 | /* Modes for retasking pin widgets */ |
| 13436 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13437 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13438 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13439 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13440 | |
| 13441 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13442 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13443 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13444 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13445 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13446 | |
| 13447 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13448 | * The ALC268 does not have an SPDIF input. |
| 13449 | */ |
| 13450 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13451 | |
| 13452 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13453 | * this output to turn on an external amplifier. |
| 13454 | */ |
| 13455 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13456 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13457 | |
| 13458 | { } /* end */ |
| 13459 | }; |
| 13460 | #endif |
| 13461 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13462 | /* create input playback/capture controls for the given pin */ |
| 13463 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13464 | const char *ctlname, int idx) |
| 13465 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13466 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13467 | int err; |
| 13468 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13469 | switch (nid) { |
| 13470 | case 0x14: |
| 13471 | case 0x16: |
| 13472 | dac = 0x02; |
| 13473 | break; |
| 13474 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13475 | case 0x1a: /* ALC259/269 only */ |
| 13476 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13477 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13478 | dac = 0x03; |
| 13479 | break; |
| 13480 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13481 | snd_printd(KERN_WARNING "hda_codec: " |
| 13482 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13483 | return 0; |
| 13484 | } |
| 13485 | if (spec->multiout.dac_nids[0] != dac && |
| 13486 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13487 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13488 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13489 | HDA_OUTPUT)); |
| 13490 | if (err < 0) |
| 13491 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13492 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13493 | } |
| 13494 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13495 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13496 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13497 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13498 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13499 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13500 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13501 | if (err < 0) |
| 13502 | return err; |
| 13503 | return 0; |
| 13504 | } |
| 13505 | |
| 13506 | /* add playback controls from the parsed DAC table */ |
| 13507 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13508 | const struct auto_pin_cfg *cfg) |
| 13509 | { |
| 13510 | hda_nid_t nid; |
| 13511 | int err; |
| 13512 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13513 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13514 | |
| 13515 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13516 | if (nid) { |
| 13517 | const char *name; |
| 13518 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13519 | name = "Speaker"; |
| 13520 | else |
| 13521 | name = "Front"; |
| 13522 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13523 | if (err < 0) |
| 13524 | return err; |
| 13525 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13526 | |
| 13527 | nid = cfg->speaker_pins[0]; |
| 13528 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13529 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13530 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13531 | if (err < 0) |
| 13532 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13533 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13534 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13535 | if (err < 0) |
| 13536 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13537 | } |
| 13538 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13539 | if (nid) { |
| 13540 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13541 | if (err < 0) |
| 13542 | return err; |
| 13543 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13544 | |
| 13545 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13546 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13547 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13548 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13549 | if (err < 0) |
| 13550 | return err; |
| 13551 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13552 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13553 | } |
| 13554 | |
| 13555 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13556 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13557 | const struct auto_pin_cfg *cfg) |
| 13558 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13559 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13560 | } |
| 13561 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13562 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13563 | hda_nid_t nid, int pin_type) |
| 13564 | { |
| 13565 | int idx; |
| 13566 | |
| 13567 | alc_set_pin_output(codec, nid, pin_type); |
| 13568 | if (nid == 0x14 || nid == 0x16) |
| 13569 | idx = 0; |
| 13570 | else |
| 13571 | idx = 1; |
| 13572 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13573 | } |
| 13574 | |
| 13575 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13576 | { |
| 13577 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13578 | int i; |
| 13579 | |
| 13580 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13581 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13582 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13583 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13584 | } |
| 13585 | } |
| 13586 | |
| 13587 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13588 | { |
| 13589 | struct alc_spec *spec = codec->spec; |
| 13590 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13591 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13592 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13593 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13594 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13595 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13596 | } |
| 13597 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13598 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13599 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13600 | } |
| 13601 | if (spec->autocfg.mono_out_pin) |
| 13602 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13603 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13604 | } |
| 13605 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13606 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13607 | { |
| 13608 | struct alc_spec *spec = codec->spec; |
| 13609 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13610 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13611 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13612 | unsigned int dac_vol1, dac_vol2; |
| 13613 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13614 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13615 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13616 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13617 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13618 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13619 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13620 | AMP_IN_UNMUTE(1)); |
| 13621 | snd_hda_codec_write(codec, 0x10, 0, |
| 13622 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13623 | AMP_IN_UNMUTE(1)); |
| 13624 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13625 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13626 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13627 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13628 | snd_hda_codec_write(codec, 0x10, 0, |
| 13629 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13630 | } |
| 13631 | |
| 13632 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13633 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13634 | dac_vol2 = AMP_OUT_ZERO; |
| 13635 | else if (line_nid == 0x15) |
| 13636 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13637 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13638 | dac_vol2 = AMP_OUT_ZERO; |
| 13639 | else if (hp_nid == 0x15) |
| 13640 | dac_vol1 = AMP_OUT_ZERO; |
| 13641 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13642 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13643 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13644 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13645 | |
| 13646 | snd_hda_codec_write(codec, 0x02, 0, |
| 13647 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13648 | snd_hda_codec_write(codec, 0x03, 0, |
| 13649 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13650 | } |
| 13651 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13652 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13653 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13654 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13655 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13656 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13657 | |
| 13658 | /* |
| 13659 | * BIOS auto configuration |
| 13660 | */ |
| 13661 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13662 | { |
| 13663 | struct alc_spec *spec = codec->spec; |
| 13664 | int err; |
| 13665 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13666 | |
| 13667 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13668 | alc268_ignore); |
| 13669 | if (err < 0) |
| 13670 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13671 | if (!spec->autocfg.line_outs) { |
| 13672 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13673 | spec->multiout.max_channels = 2; |
| 13674 | spec->no_analog = 1; |
| 13675 | goto dig_only; |
| 13676 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13677 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13678 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13679 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13680 | if (err < 0) |
| 13681 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13682 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13683 | if (err < 0) |
| 13684 | return err; |
| 13685 | |
| 13686 | spec->multiout.max_channels = 2; |
| 13687 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13688 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13689 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13690 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13691 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13692 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13693 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13694 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13695 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13696 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13697 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13698 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13699 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13700 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13701 | err = alc_auto_add_mic_boost(codec); |
| 13702 | if (err < 0) |
| 13703 | return err; |
| 13704 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13705 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13706 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13707 | return 1; |
| 13708 | } |
| 13709 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13710 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13711 | |
| 13712 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13713 | static void alc268_auto_init(struct hda_codec *codec) |
| 13714 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13715 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13716 | alc268_auto_init_multi_out(codec); |
| 13717 | alc268_auto_init_hp_out(codec); |
| 13718 | alc268_auto_init_mono_speaker_out(codec); |
| 13719 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13720 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13721 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13722 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13723 | } |
| 13724 | |
| 13725 | /* |
| 13726 | * configuration and preset |
| 13727 | */ |
| 13728 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13729 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13730 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13731 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13732 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13733 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13734 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13735 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13736 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13737 | #ifdef CONFIG_SND_DEBUG |
| 13738 | [ALC268_TEST] = "test", |
| 13739 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13740 | [ALC268_AUTO] = "auto", |
| 13741 | }; |
| 13742 | |
| 13743 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13744 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13745 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13746 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13747 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13748 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13749 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13750 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13751 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13752 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13753 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13754 | /* almost compatible with toshiba but with optional digital outs; |
| 13755 | * auto-probing seems working fine |
| 13756 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13757 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13758 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13759 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13760 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13761 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13762 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13763 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13764 | {} |
| 13765 | }; |
| 13766 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13767 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13768 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13769 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13770 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13771 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13772 | ALC268_TOSHIBA), |
| 13773 | {} |
| 13774 | }; |
| 13775 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13776 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13777 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13778 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13779 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13780 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13781 | alc267_quanta_il1_verbs }, |
| 13782 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13783 | .dac_nids = alc268_dac_nids, |
| 13784 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13785 | .adc_nids = alc268_adc_nids_alt, |
| 13786 | .hp_nid = 0x03, |
| 13787 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13788 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13789 | .unsol_event = alc_sku_unsol_event, |
| 13790 | .setup = alc267_quanta_il1_setup, |
| 13791 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13792 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13793 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13794 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13795 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13796 | .init_verbs = { alc268_base_init_verbs }, |
| 13797 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13798 | .dac_nids = alc268_dac_nids, |
| 13799 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13800 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13801 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13802 | .hp_nid = 0x03, |
| 13803 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13804 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13805 | .channel_mode = alc268_modes, |
| 13806 | .input_mux = &alc268_capture_source, |
| 13807 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13808 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13809 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13810 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13811 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13812 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13813 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13814 | .dac_nids = alc268_dac_nids, |
| 13815 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13816 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13817 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13818 | .hp_nid = 0x03, |
| 13819 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13820 | .channel_mode = alc268_modes, |
| 13821 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13822 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13823 | .setup = alc268_toshiba_setup, |
| 13824 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13825 | }, |
| 13826 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13827 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13828 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13829 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13830 | alc268_acer_verbs }, |
| 13831 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13832 | .dac_nids = alc268_dac_nids, |
| 13833 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13834 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13835 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13836 | .hp_nid = 0x02, |
| 13837 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13838 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13839 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13840 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13841 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13842 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13843 | [ALC268_ACER_DMIC] = { |
| 13844 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13845 | alc268_beep_mixer }, |
| 13846 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13847 | alc268_acer_verbs }, |
| 13848 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13849 | .dac_nids = alc268_dac_nids, |
| 13850 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13851 | .adc_nids = alc268_adc_nids_alt, |
| 13852 | .capsrc_nids = alc268_capsrc_nids, |
| 13853 | .hp_nid = 0x02, |
| 13854 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13855 | .channel_mode = alc268_modes, |
| 13856 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13857 | .unsol_event = alc268_acer_unsol_event, |
| 13858 | .init_hook = alc268_acer_init_hook, |
| 13859 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13860 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13861 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13862 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13863 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13864 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13865 | alc268_acer_aspire_one_verbs }, |
| 13866 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13867 | .dac_nids = alc268_dac_nids, |
| 13868 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13869 | .adc_nids = alc268_adc_nids_alt, |
| 13870 | .capsrc_nids = alc268_capsrc_nids, |
| 13871 | .hp_nid = 0x03, |
| 13872 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13873 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13874 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13875 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13876 | .init_hook = alc268_acer_lc_init_hook, |
| 13877 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13878 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13879 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13880 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13881 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13882 | alc268_dell_verbs }, |
| 13883 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13884 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13885 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13886 | .adc_nids = alc268_adc_nids_alt, |
| 13887 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13888 | .hp_nid = 0x02, |
| 13889 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13890 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13891 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13892 | .setup = alc268_dell_setup, |
| 13893 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13894 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13895 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13896 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13897 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13898 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13899 | alc268_toshiba_verbs }, |
| 13900 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13901 | .dac_nids = alc268_dac_nids, |
| 13902 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13903 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13904 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13905 | .hp_nid = 0x03, |
| 13906 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13907 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13908 | .channel_mode = alc268_modes, |
| 13909 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13910 | .setup = alc268_toshiba_setup, |
| 13911 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13912 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13913 | #ifdef CONFIG_SND_DEBUG |
| 13914 | [ALC268_TEST] = { |
| 13915 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13916 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13917 | alc268_volume_init_verbs }, |
| 13918 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13919 | .dac_nids = alc268_dac_nids, |
| 13920 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13921 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13922 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13923 | .hp_nid = 0x03, |
| 13924 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13925 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13926 | .channel_mode = alc268_modes, |
| 13927 | .input_mux = &alc268_capture_source, |
| 13928 | }, |
| 13929 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13930 | }; |
| 13931 | |
| 13932 | static int patch_alc268(struct hda_codec *codec) |
| 13933 | { |
| 13934 | struct alc_spec *spec; |
| 13935 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13936 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13937 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13938 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13939 | if (spec == NULL) |
| 13940 | return -ENOMEM; |
| 13941 | |
| 13942 | codec->spec = spec; |
| 13943 | |
| 13944 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13945 | alc268_models, |
| 13946 | alc268_cfg_tbl); |
| 13947 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13948 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13949 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13950 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13951 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13952 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13953 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13954 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13955 | board_config = ALC268_AUTO; |
| 13956 | } |
| 13957 | |
| 13958 | if (board_config == ALC268_AUTO) { |
| 13959 | /* automatic parse from the BIOS config */ |
| 13960 | err = alc268_parse_auto_config(codec); |
| 13961 | if (err < 0) { |
| 13962 | alc_free(codec); |
| 13963 | return err; |
| 13964 | } else if (!err) { |
| 13965 | printk(KERN_INFO |
| 13966 | "hda_codec: Cannot set up configuration " |
| 13967 | "from BIOS. Using base mode...\n"); |
| 13968 | board_config = ALC268_3ST; |
| 13969 | } |
| 13970 | } |
| 13971 | |
| 13972 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13973 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13974 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13975 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13976 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13977 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13978 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13979 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13980 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13981 | has_beep = 0; |
| 13982 | for (i = 0; i < spec->num_mixers; i++) { |
| 13983 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13984 | has_beep = 1; |
| 13985 | break; |
| 13986 | } |
| 13987 | } |
| 13988 | |
| 13989 | if (has_beep) { |
| 13990 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13991 | if (err < 0) { |
| 13992 | alc_free(codec); |
| 13993 | return err; |
| 13994 | } |
| 13995 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13996 | /* override the amp caps for beep generator */ |
| 13997 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13998 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13999 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14000 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14001 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14002 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14003 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14004 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14005 | /* check whether NID 0x07 is valid */ |
| 14006 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14007 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14008 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14009 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14010 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14011 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14012 | if (spec->auto_mic || |
| 14013 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14014 | spec->adc_nids = alc268_adc_nids_alt; |
| 14015 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14016 | if (spec->auto_mic) |
| 14017 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14018 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14019 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14020 | else |
| 14021 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14022 | } else { |
| 14023 | spec->adc_nids = alc268_adc_nids; |
| 14024 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14025 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14026 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14027 | /* set default input source */ |
| 14028 | for (i = 0; i < spec->num_adc_nids; i++) |
| 14029 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 14030 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 14031 | i < spec->num_mux_defs ? |
| 14032 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14033 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14034 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14035 | |
| 14036 | spec->vmaster_nid = 0x02; |
| 14037 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14038 | codec->patch_ops = alc_patch_ops; |
| 14039 | if (board_config == ALC268_AUTO) |
| 14040 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14041 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14042 | alc_init_jacks(codec); |
| 14043 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14044 | return 0; |
| 14045 | } |
| 14046 | |
| 14047 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14048 | * ALC269 channel source setting (2 channel) |
| 14049 | */ |
| 14050 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14051 | |
| 14052 | #define alc269_dac_nids alc260_dac_nids |
| 14053 | |
| 14054 | static hda_nid_t alc269_adc_nids[1] = { |
| 14055 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14056 | 0x08, |
| 14057 | }; |
| 14058 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14059 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14060 | 0x23, |
| 14061 | }; |
| 14062 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14063 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14064 | /* ADC1 */ |
| 14065 | 0x09, |
| 14066 | }; |
| 14067 | |
| 14068 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14069 | 0x22, |
| 14070 | }; |
| 14071 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14072 | static hda_nid_t alc269_adc_candidates[] = { |
| 14073 | 0x08, 0x09, 0x07, |
| 14074 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14075 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14076 | #define alc269_modes alc260_modes |
| 14077 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14078 | |
| 14079 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14081 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14082 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14083 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14086 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14087 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14088 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 14089 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14090 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14091 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14092 | { } /* end */ |
| 14093 | }; |
| 14094 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14095 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14096 | /* output mixer control */ |
| 14097 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14098 | { |
| 14099 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14100 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14101 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14102 | .info = snd_hda_mixer_amp_switch_info, |
| 14103 | .get = snd_hda_mixer_amp_switch_get, |
| 14104 | .put = alc268_acer_master_sw_put, |
| 14105 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14106 | }, |
| 14107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14109 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14110 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14111 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 14112 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14113 | { } |
| 14114 | }; |
| 14115 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14116 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14117 | /* output mixer control */ |
| 14118 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14119 | { |
| 14120 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14121 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14122 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14123 | .info = snd_hda_mixer_amp_switch_info, |
| 14124 | .get = snd_hda_mixer_amp_switch_get, |
| 14125 | .put = alc268_acer_master_sw_put, |
| 14126 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14127 | }, |
| 14128 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14129 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14130 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14131 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14132 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 14133 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 14134 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14135 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 14136 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14137 | { } |
| 14138 | }; |
| 14139 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14140 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14141 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14142 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14143 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14144 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14145 | { } /* end */ |
| 14146 | }; |
| 14147 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14148 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14149 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14150 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14151 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14152 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14153 | { } /* end */ |
| 14154 | }; |
| 14155 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14156 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14157 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14158 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14159 | { } /* end */ |
| 14160 | }; |
| 14161 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14162 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14163 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14164 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14165 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 14166 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14167 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 14168 | { } /* end */ |
| 14169 | }; |
| 14170 | |
| 14171 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14172 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14173 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14174 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14175 | { } /* end */ |
| 14176 | }; |
| 14177 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14178 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14179 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14180 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14181 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14182 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 14183 | { } /* end */ |
| 14184 | }; |
| 14185 | |
| 14186 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14187 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14188 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14189 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14190 | { } /* end */ |
| 14191 | }; |
| 14192 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14193 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14194 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14195 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14196 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14197 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14198 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14199 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14200 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14201 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14202 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14203 | { } |
| 14204 | }; |
| 14205 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14206 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14207 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14208 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14209 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14210 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14211 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14212 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14213 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14214 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14215 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14216 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14217 | { } |
| 14218 | }; |
| 14219 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14220 | /* toggle speaker-output according to the hp-jack state */ |
| 14221 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14222 | { |
| 14223 | unsigned int present; |
| 14224 | unsigned char bits; |
| 14225 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14226 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14227 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14228 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14229 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14230 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14231 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14232 | |
| 14233 | snd_hda_codec_write(codec, 0x20, 0, |
| 14234 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14235 | snd_hda_codec_write(codec, 0x20, 0, |
| 14236 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14237 | |
| 14238 | snd_hda_codec_write(codec, 0x20, 0, |
| 14239 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14240 | snd_hda_codec_write(codec, 0x20, 0, |
| 14241 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14242 | } |
| 14243 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14244 | /* toggle speaker-output according to the hp-jacks state */ |
| 14245 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14246 | { |
| 14247 | unsigned int present; |
| 14248 | unsigned char bits; |
| 14249 | |
| 14250 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14251 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14252 | |
| 14253 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14254 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14255 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14256 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14257 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14258 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14259 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14260 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14261 | |
| 14262 | snd_hda_codec_write(codec, 0x20, 0, |
| 14263 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14264 | snd_hda_codec_write(codec, 0x20, 0, |
| 14265 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14266 | |
| 14267 | snd_hda_codec_write(codec, 0x20, 0, |
| 14268 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14269 | snd_hda_codec_write(codec, 0x20, 0, |
| 14270 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14271 | } |
| 14272 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14273 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14274 | { |
| 14275 | unsigned int present_laptop; |
| 14276 | unsigned int present_dock; |
| 14277 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14278 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14279 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14280 | |
| 14281 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14282 | if (present_dock) |
| 14283 | snd_hda_codec_write(codec, 0x23, 0, |
| 14284 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14285 | if (present_laptop) |
| 14286 | snd_hda_codec_write(codec, 0x23, 0, |
| 14287 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14288 | if (!present_dock && !present_laptop) |
| 14289 | snd_hda_codec_write(codec, 0x23, 0, |
| 14290 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14291 | } |
| 14292 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14293 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14294 | unsigned int res) |
| 14295 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14296 | switch (res >> 26) { |
| 14297 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14298 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14299 | break; |
| 14300 | case ALC880_MIC_EVENT: |
| 14301 | alc_mic_automute(codec); |
| 14302 | break; |
| 14303 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14304 | } |
| 14305 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14306 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14307 | unsigned int res) |
| 14308 | { |
| 14309 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14310 | alc269_lifebook_speaker_automute(codec); |
| 14311 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14312 | alc269_lifebook_mic_autoswitch(codec); |
| 14313 | } |
| 14314 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14315 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14316 | { |
| 14317 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14318 | spec->autocfg.hp_pins[0] = 0x15; |
| 14319 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14320 | spec->ext_mic.pin = 0x18; |
| 14321 | spec->ext_mic.mux_idx = 0; |
| 14322 | spec->int_mic.pin = 0x19; |
| 14323 | spec->int_mic.mux_idx = 1; |
| 14324 | spec->auto_mic = 1; |
| 14325 | } |
| 14326 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14327 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14328 | { |
| 14329 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14330 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14331 | } |
| 14332 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14333 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14334 | { |
| 14335 | alc269_lifebook_speaker_automute(codec); |
| 14336 | alc269_lifebook_mic_autoswitch(codec); |
| 14337 | } |
| 14338 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14339 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14340 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14341 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14342 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14343 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14344 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14345 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14346 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14347 | {} |
| 14348 | }; |
| 14349 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14350 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14351 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14352 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14353 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14354 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14355 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14356 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14357 | {} |
| 14358 | }; |
| 14359 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14360 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14361 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14362 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14363 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14364 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14365 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14366 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14367 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14368 | {} |
| 14369 | }; |
| 14370 | |
| 14371 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14372 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14373 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14374 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14376 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14377 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14378 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14379 | {} |
| 14380 | }; |
| 14381 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14382 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14383 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14384 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14385 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14387 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14388 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14389 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14390 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14391 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14392 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14393 | { } |
| 14394 | }; |
| 14395 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14396 | /* toggle speaker-output according to the hp-jack state */ |
| 14397 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14398 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14399 | struct alc_spec *spec = codec->spec; |
| 14400 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14401 | unsigned int present; |
| 14402 | unsigned char bits; |
| 14403 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14404 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14405 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14406 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14407 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14408 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14409 | HDA_AMP_MUTE, bits); |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14410 | alc_report_jack(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14411 | } |
| 14412 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14413 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14414 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14415 | unsigned int res) |
| 14416 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14417 | switch (res >> 26) { |
| 14418 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14419 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14420 | break; |
| 14421 | case ALC880_MIC_EVENT: |
| 14422 | alc_mic_automute(codec); |
| 14423 | break; |
| 14424 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14425 | } |
| 14426 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14427 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14428 | { |
| 14429 | struct alc_spec *spec = codec->spec; |
| 14430 | spec->autocfg.hp_pins[0] = 0x15; |
| 14431 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14432 | spec->ext_mic.pin = 0x18; |
| 14433 | spec->ext_mic.mux_idx = 0; |
| 14434 | spec->int_mic.pin = 0x19; |
| 14435 | spec->int_mic.mux_idx = 1; |
| 14436 | spec->auto_mic = 1; |
| 14437 | } |
| 14438 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14439 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14440 | { |
| 14441 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14442 | spec->autocfg.hp_pins[0] = 0x15; |
| 14443 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14444 | spec->ext_mic.pin = 0x18; |
| 14445 | spec->ext_mic.mux_idx = 0; |
| 14446 | spec->int_mic.pin = 0x12; |
| 14447 | spec->int_mic.mux_idx = 5; |
| 14448 | spec->auto_mic = 1; |
| 14449 | } |
| 14450 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14451 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14452 | { |
| 14453 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14454 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14455 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14456 | spec->ext_mic.pin = 0x18; |
| 14457 | spec->ext_mic.mux_idx = 0; |
| 14458 | spec->int_mic.pin = 0x19; |
| 14459 | spec->int_mic.mux_idx = 1; |
| 14460 | spec->auto_mic = 1; |
| 14461 | } |
| 14462 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14463 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14464 | { |
| 14465 | struct alc_spec *spec = codec->spec; |
| 14466 | spec->autocfg.hp_pins[0] = 0x21; |
| 14467 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14468 | spec->ext_mic.pin = 0x18; |
| 14469 | spec->ext_mic.mux_idx = 0; |
| 14470 | spec->int_mic.pin = 0x12; |
| 14471 | spec->int_mic.mux_idx = 6; |
| 14472 | spec->auto_mic = 1; |
| 14473 | } |
| 14474 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14475 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14476 | { |
| 14477 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14478 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14479 | } |
| 14480 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14481 | /* |
| 14482 | * generic initialization of ADC, input mixers and output mixers |
| 14483 | */ |
| 14484 | static struct hda_verb alc269_init_verbs[] = { |
| 14485 | /* |
| 14486 | * Unmute ADC0 and set the default input to mic-in |
| 14487 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14488 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14489 | |
| 14490 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14491 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14492 | */ |
| 14493 | /* set vol=0 to output mixers */ |
| 14494 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14495 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14496 | |
| 14497 | /* set up input amps for analog loopback */ |
| 14498 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14499 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14500 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14501 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14502 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14503 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14504 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14505 | |
| 14506 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14507 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14508 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14509 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14510 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14511 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14512 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14513 | |
| 14514 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14515 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14516 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14517 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14518 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14519 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14520 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14521 | |
| 14522 | /* set EAPD */ |
| 14523 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14524 | { } |
| 14525 | }; |
| 14526 | |
| 14527 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14528 | /* |
| 14529 | * Unmute ADC0 and set the default input to mic-in |
| 14530 | */ |
| 14531 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14532 | |
| 14533 | /* |
| 14534 | * Set up output mixers (0x02 - 0x03) |
| 14535 | */ |
| 14536 | /* set vol=0 to output mixers */ |
| 14537 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14538 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14539 | |
| 14540 | /* set up input amps for analog loopback */ |
| 14541 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14542 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14543 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14544 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14545 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14546 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14547 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14548 | |
| 14549 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14550 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14551 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14552 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14553 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14554 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14555 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14556 | |
| 14557 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14558 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14559 | |
| 14560 | /* FIXME: use Mux-type input source selection */ |
| 14561 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14562 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14563 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14564 | |
| 14565 | /* set EAPD */ |
| 14566 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14567 | { } |
| 14568 | }; |
| 14569 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14570 | #define alc269_auto_create_multi_out_ctls \ |
| 14571 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14572 | #define alc269_auto_create_input_ctls \ |
| 14573 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14574 | |
| 14575 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14576 | #define alc269_loopbacks alc880_loopbacks |
| 14577 | #endif |
| 14578 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14579 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14580 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14581 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14582 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14583 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14584 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14585 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14586 | .substreams = 1, |
| 14587 | .channels_min = 2, |
| 14588 | .channels_max = 8, |
| 14589 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14590 | /* NID is set in alc_build_pcms */ |
| 14591 | .ops = { |
| 14592 | .open = alc880_playback_pcm_open, |
| 14593 | .prepare = alc880_playback_pcm_prepare, |
| 14594 | .cleanup = alc880_playback_pcm_cleanup |
| 14595 | }, |
| 14596 | }; |
| 14597 | |
| 14598 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14599 | .substreams = 1, |
| 14600 | .channels_min = 2, |
| 14601 | .channels_max = 2, |
| 14602 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14603 | /* NID is set in alc_build_pcms */ |
| 14604 | }; |
| 14605 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14606 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14607 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14608 | { |
| 14609 | switch (codec->subsystem_id) { |
| 14610 | case 0x103c1586: |
| 14611 | return 1; |
| 14612 | } |
| 14613 | return 0; |
| 14614 | } |
| 14615 | |
| 14616 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14617 | { |
| 14618 | /* update mute-LED according to the speaker mute state */ |
| 14619 | if (nid == 0x01 || nid == 0x14) { |
| 14620 | int pinval; |
| 14621 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14622 | HDA_AMP_MUTE) |
| 14623 | pinval = 0x24; |
| 14624 | else |
| 14625 | pinval = 0x20; |
| 14626 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14627 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14628 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14629 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14630 | } |
| 14631 | return alc_check_power_status(codec, nid); |
| 14632 | } |
| 14633 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14634 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14635 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14636 | { |
| 14637 | struct alc_spec *spec = codec->spec; |
| 14638 | |
| 14639 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14640 | return 0; |
| 14641 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14642 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14643 | if (spec->ext_mic.pin <= 0x12) { |
| 14644 | spec->private_adc_nids[0] = 0x08; |
| 14645 | spec->private_adc_nids[1] = 0x11; |
| 14646 | spec->private_capsrc_nids[0] = 0x23; |
| 14647 | spec->private_capsrc_nids[1] = 0x22; |
| 14648 | } else { |
| 14649 | spec->private_adc_nids[0] = 0x11; |
| 14650 | spec->private_adc_nids[1] = 0x08; |
| 14651 | spec->private_capsrc_nids[0] = 0x22; |
| 14652 | spec->private_capsrc_nids[1] = 0x23; |
| 14653 | } |
| 14654 | spec->adc_nids = spec->private_adc_nids; |
| 14655 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14656 | spec->num_adc_nids = 2; |
| 14657 | spec->dual_adc_switch = 1; |
| 14658 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14659 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14660 | return 1; |
| 14661 | } |
| 14662 | return 0; |
| 14663 | } |
| 14664 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14665 | /* different alc269-variants */ |
| 14666 | enum { |
| 14667 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14668 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14669 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14670 | ALC269_TYPE_ALC269VB, |
| 14671 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14672 | ALC269_TYPE_ALC271X, |
| 14673 | }; |
| 14674 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14675 | /* |
| 14676 | * BIOS auto configuration |
| 14677 | */ |
| 14678 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14679 | { |
| 14680 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14681 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14682 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14683 | |
| 14684 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14685 | alc269_ignore); |
| 14686 | if (err < 0) |
| 14687 | return err; |
| 14688 | |
| 14689 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14690 | if (err < 0) |
| 14691 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14692 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14693 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14694 | else |
| 14695 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14696 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14697 | if (err < 0) |
| 14698 | return err; |
| 14699 | |
| 14700 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14701 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14702 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14703 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14704 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14705 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14706 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14707 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14708 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14709 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14710 | } else { |
| 14711 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14712 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14713 | } |
| 14714 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14715 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14716 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14717 | |
| 14718 | if (!alc275_setup_dual_adc(codec)) |
| 14719 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14720 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14721 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14722 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14723 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14724 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14725 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14726 | |
| 14727 | err = alc_auto_add_mic_boost(codec); |
| 14728 | if (err < 0) |
| 14729 | return err; |
| 14730 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14731 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14732 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14733 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14734 | return 1; |
| 14735 | } |
| 14736 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14737 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14738 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14739 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14740 | |
| 14741 | |
| 14742 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14743 | static void alc269_auto_init(struct hda_codec *codec) |
| 14744 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14745 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14746 | alc269_auto_init_multi_out(codec); |
| 14747 | alc269_auto_init_hp_out(codec); |
| 14748 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14749 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14750 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14751 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14752 | } |
| 14753 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14754 | #ifdef SND_HDA_NEEDS_RESUME |
| 14755 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14756 | { |
| 14757 | int val = alc_read_coef_idx(codec, 0x04); |
| 14758 | if (power_up) |
| 14759 | val |= 1 << 11; |
| 14760 | else |
| 14761 | val &= ~(1 << 11); |
| 14762 | alc_write_coef_idx(codec, 0x04, val); |
| 14763 | } |
| 14764 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14765 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14766 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14767 | { |
| 14768 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14769 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14770 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14771 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14772 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14773 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14774 | msleep(150); |
| 14775 | } |
| 14776 | |
| 14777 | alc_shutup(codec); |
| 14778 | if (spec && spec->power_hook) |
| 14779 | spec->power_hook(codec); |
| 14780 | return 0; |
| 14781 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14782 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14783 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14784 | static int alc269_resume(struct hda_codec *codec) |
| 14785 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14786 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14787 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14788 | msleep(150); |
| 14789 | } |
| 14790 | |
| 14791 | codec->patch_ops.init(codec); |
| 14792 | |
| 14793 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14794 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14795 | msleep(200); |
| 14796 | } |
| 14797 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14798 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14799 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14800 | |
| 14801 | snd_hda_codec_resume_amp(codec); |
| 14802 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14803 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14804 | return 0; |
| 14805 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14806 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14807 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14808 | enum { |
| 14809 | ALC269_FIXUP_SONY_VAIO, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14810 | ALC269_FIXUP_DELL_M101Z, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14811 | }; |
| 14812 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14813 | static const struct alc_fixup alc269_fixups[] = { |
| 14814 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14815 | .verbs = (const struct hda_verb[]) { |
| 14816 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14817 | {} |
| 14818 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14819 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14820 | [ALC269_FIXUP_DELL_M101Z] = { |
| 14821 | .verbs = (const struct hda_verb[]) { |
| 14822 | /* Enables internal speaker */ |
| 14823 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14824 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14825 | {} |
| 14826 | } |
| 14827 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14828 | }; |
| 14829 | |
| 14830 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | abdd8f5 | 2010-09-21 17:38:14 +0200 | [diff] [blame] | 14831 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14832 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14833 | {} |
| 14834 | }; |
| 14835 | |
| 14836 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14837 | /* |
| 14838 | * configuration and preset |
| 14839 | */ |
| 14840 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14841 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14842 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14843 | [ALC269_AMIC] = "laptop-amic", |
| 14844 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14845 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14846 | [ALC269_LIFEBOOK] = "lifebook", |
| 14847 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14848 | }; |
| 14849 | |
| 14850 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14851 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14852 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14853 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14854 | ALC269_AMIC), |
| 14855 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14856 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14857 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14858 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14859 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14860 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14861 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14862 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14863 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14864 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14865 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14866 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14867 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14868 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14869 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14870 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14871 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14872 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14873 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14874 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14875 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14876 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14877 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14878 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14879 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14880 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14881 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14882 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14883 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14884 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14885 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14886 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14887 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14888 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14889 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14890 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14891 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14892 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14893 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14894 | ALC269_DMIC), |
| 14895 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14896 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14897 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14898 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14899 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14900 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14901 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14902 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14903 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14904 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14905 | {} |
| 14906 | }; |
| 14907 | |
| 14908 | static struct alc_config_preset alc269_presets[] = { |
| 14909 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14910 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14911 | .init_verbs = { alc269_init_verbs }, |
| 14912 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14913 | .dac_nids = alc269_dac_nids, |
| 14914 | .hp_nid = 0x03, |
| 14915 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14916 | .channel_mode = alc269_modes, |
| 14917 | .input_mux = &alc269_capture_source, |
| 14918 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14919 | [ALC269_QUANTA_FL1] = { |
| 14920 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14921 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14922 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14923 | .dac_nids = alc269_dac_nids, |
| 14924 | .hp_nid = 0x03, |
| 14925 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14926 | .channel_mode = alc269_modes, |
| 14927 | .input_mux = &alc269_capture_source, |
| 14928 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14929 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14930 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14931 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14932 | [ALC269_AMIC] = { |
| 14933 | .mixers = { alc269_laptop_mixer }, |
| 14934 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14935 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14936 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14937 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14938 | .dac_nids = alc269_dac_nids, |
| 14939 | .hp_nid = 0x03, |
| 14940 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14941 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14942 | .unsol_event = alc269_laptop_unsol_event, |
| 14943 | .setup = alc269_laptop_amic_setup, |
| 14944 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14945 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14946 | [ALC269_DMIC] = { |
| 14947 | .mixers = { alc269_laptop_mixer }, |
| 14948 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14949 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14950 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14951 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14952 | .dac_nids = alc269_dac_nids, |
| 14953 | .hp_nid = 0x03, |
| 14954 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14955 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14956 | .unsol_event = alc269_laptop_unsol_event, |
| 14957 | .setup = alc269_laptop_dmic_setup, |
| 14958 | .init_hook = alc269_laptop_inithook, |
| 14959 | }, |
| 14960 | [ALC269VB_AMIC] = { |
| 14961 | .mixers = { alc269vb_laptop_mixer }, |
| 14962 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14963 | .init_verbs = { alc269vb_init_verbs, |
| 14964 | alc269vb_laptop_amic_init_verbs }, |
| 14965 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14966 | .dac_nids = alc269_dac_nids, |
| 14967 | .hp_nid = 0x03, |
| 14968 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14969 | .channel_mode = alc269_modes, |
| 14970 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14971 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14972 | .init_hook = alc269_laptop_inithook, |
| 14973 | }, |
| 14974 | [ALC269VB_DMIC] = { |
| 14975 | .mixers = { alc269vb_laptop_mixer }, |
| 14976 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14977 | .init_verbs = { alc269vb_init_verbs, |
| 14978 | alc269vb_laptop_dmic_init_verbs }, |
| 14979 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14980 | .dac_nids = alc269_dac_nids, |
| 14981 | .hp_nid = 0x03, |
| 14982 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14983 | .channel_mode = alc269_modes, |
| 14984 | .unsol_event = alc269_laptop_unsol_event, |
| 14985 | .setup = alc269vb_laptop_dmic_setup, |
| 14986 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14987 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14988 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14989 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14990 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14991 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14992 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14993 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14994 | .dac_nids = alc269_dac_nids, |
| 14995 | .hp_nid = 0x03, |
| 14996 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14997 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14998 | .unsol_event = alc269_laptop_unsol_event, |
| 14999 | .setup = alc269_laptop_dmic_setup, |
| 15000 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15001 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15002 | [ALC269_LIFEBOOK] = { |
| 15003 | .mixers = { alc269_lifebook_mixer }, |
| 15004 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15005 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15006 | .dac_nids = alc269_dac_nids, |
| 15007 | .hp_nid = 0x03, |
| 15008 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15009 | .channel_mode = alc269_modes, |
| 15010 | .input_mux = &alc269_capture_source, |
| 15011 | .unsol_event = alc269_lifebook_unsol_event, |
| 15012 | .init_hook = alc269_lifebook_init_hook, |
| 15013 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15014 | [ALC271_ACER] = { |
| 15015 | .mixers = { alc269_asus_mixer }, |
| 15016 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15017 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15018 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15019 | .dac_nids = alc269_dac_nids, |
| 15020 | .adc_nids = alc262_dmic_adc_nids, |
| 15021 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15022 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15023 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15024 | .channel_mode = alc269_modes, |
| 15025 | .input_mux = &alc269_capture_source, |
| 15026 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15027 | .unsol_event = alc_sku_unsol_event, |
| 15028 | .setup = alc269vb_laptop_dmic_setup, |
| 15029 | .init_hook = alc_inithook, |
| 15030 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15031 | }; |
| 15032 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15033 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15034 | { |
| 15035 | int val; |
| 15036 | |
| 15037 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15038 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15039 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15040 | } |
| 15041 | |
| 15042 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15043 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15044 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15045 | } |
| 15046 | |
| 15047 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15048 | val = alc_read_coef_idx(codec, 0x04); |
| 15049 | /* Power up output pin */ |
| 15050 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15051 | } |
| 15052 | |
| 15053 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15054 | val = alc_read_coef_idx(codec, 0xd); |
| 15055 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15056 | /* Capless ramp up clock control */ |
| 15057 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15058 | } |
| 15059 | val = alc_read_coef_idx(codec, 0x17); |
| 15060 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15061 | /* Class D power on reset */ |
| 15062 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15063 | } |
| 15064 | } |
| 15065 | return 0; |
| 15066 | } |
| 15067 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15068 | static int patch_alc269(struct hda_codec *codec) |
| 15069 | { |
| 15070 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15071 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15072 | int err; |
| 15073 | |
| 15074 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15075 | if (spec == NULL) |
| 15076 | return -ENOMEM; |
| 15077 | |
| 15078 | codec->spec = spec; |
| 15079 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15080 | alc_auto_parse_customize_define(codec); |
| 15081 | |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15082 | coef = alc_read_coef_idx(codec, 0); |
| 15083 | if ((coef & 0x00f0) == 0x0010) { |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15084 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15085 | spec->cdefine.platform_type == 1) { |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15086 | alc_codec_rename(codec, "ALC271X"); |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15087 | spec->codec_variant = ALC269_TYPE_ALC271X; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15088 | } else if ((coef & 0xf000) == 0x1000) { |
| 15089 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15090 | } else if ((coef & 0xf000) == 0x2000) { |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15091 | alc_codec_rename(codec, "ALC259"); |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15092 | spec->codec_variant = ALC269_TYPE_ALC259; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15093 | } else if ((coef & 0xf000) == 0x3000) { |
| 15094 | alc_codec_rename(codec, "ALC258"); |
| 15095 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15096 | } else { |
| 15097 | alc_codec_rename(codec, "ALC269VB"); |
| 15098 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15099 | } |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15100 | } else |
| 15101 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 15102 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15103 | alc269_fill_coef(codec); |
| 15104 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15105 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15106 | alc269_models, |
| 15107 | alc269_cfg_tbl); |
| 15108 | |
| 15109 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15110 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15111 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15112 | board_config = ALC269_AUTO; |
| 15113 | } |
| 15114 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15115 | if (board_config == ALC269_AUTO) |
| 15116 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 15117 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15118 | if (board_config == ALC269_AUTO) { |
| 15119 | /* automatic parse from the BIOS config */ |
| 15120 | err = alc269_parse_auto_config(codec); |
| 15121 | if (err < 0) { |
| 15122 | alc_free(codec); |
| 15123 | return err; |
| 15124 | } else if (!err) { |
| 15125 | printk(KERN_INFO |
| 15126 | "hda_codec: Cannot set up configuration " |
| 15127 | "from BIOS. Using base mode...\n"); |
| 15128 | board_config = ALC269_BASIC; |
| 15129 | } |
| 15130 | } |
| 15131 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15132 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15133 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15134 | if (err < 0) { |
| 15135 | alc_free(codec); |
| 15136 | return err; |
| 15137 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15138 | } |
| 15139 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15140 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15141 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15142 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15143 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15144 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15145 | * fix the sample rate of analog I/O to 44.1kHz |
| 15146 | */ |
| 15147 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15148 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15149 | } else if (spec->dual_adc_switch) { |
| 15150 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15151 | /* switch ADC dynamically */ |
| 15152 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15153 | } else { |
| 15154 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15155 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15156 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15157 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15158 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15159 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15160 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15161 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15162 | spec->adc_nids = alc269_adc_nids; |
| 15163 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15164 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15165 | } else { |
| 15166 | spec->adc_nids = alc269vb_adc_nids; |
| 15167 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15168 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15169 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15170 | } |
| 15171 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15172 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15173 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15174 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15175 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15176 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15177 | if (board_config == ALC269_AUTO) |
| 15178 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 15179 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15180 | spec->vmaster_nid = 0x02; |
| 15181 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15182 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15183 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15184 | codec->patch_ops.suspend = alc269_suspend; |
| 15185 | #endif |
| 15186 | #ifdef SND_HDA_NEEDS_RESUME |
| 15187 | codec->patch_ops.resume = alc269_resume; |
| 15188 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15189 | if (board_config == ALC269_AUTO) |
| 15190 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15191 | |
| 15192 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15193 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15194 | if (!spec->loopback.amplist) |
| 15195 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15196 | if (alc269_mic2_for_mute_led(codec)) |
| 15197 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15198 | #endif |
| 15199 | |
| 15200 | return 0; |
| 15201 | } |
| 15202 | |
| 15203 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15204 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15205 | */ |
| 15206 | |
| 15207 | /* |
| 15208 | * set the path ways for 2 channel output |
| 15209 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15210 | */ |
| 15211 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15212 | /* set pin widget 1Ah (line in) for input */ |
| 15213 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15214 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15215 | * the vref |
| 15216 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15217 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15218 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15219 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15220 | #if 0 |
| 15221 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15222 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15223 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15224 | { } /* end */ |
| 15225 | }; |
| 15226 | /* |
| 15227 | * 6ch mode |
| 15228 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15229 | */ |
| 15230 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15231 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15232 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15233 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15234 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15235 | |
| 15236 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15237 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15238 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15239 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15240 | #if 0 |
| 15241 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15242 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15243 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15244 | { } /* end */ |
| 15245 | }; |
| 15246 | |
| 15247 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15248 | { 2, alc861_threestack_ch2_init }, |
| 15249 | { 6, alc861_threestack_ch6_init }, |
| 15250 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15251 | /* Set mic1 as input and unmute the mixer */ |
| 15252 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15253 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15254 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15255 | { } /* end */ |
| 15256 | }; |
| 15257 | /* Set mic1 as output and mute mixer */ |
| 15258 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15259 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15260 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15261 | { } /* end */ |
| 15262 | }; |
| 15263 | |
| 15264 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15265 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15266 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15267 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15268 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15269 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15270 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15271 | /* set pin widget 1Ah (line in) for input */ |
| 15272 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15273 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15274 | * the vref |
| 15275 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15276 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15277 | |
| 15278 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15279 | #if 0 |
| 15280 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15281 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15282 | #endif |
| 15283 | { } /* end */ |
| 15284 | }; |
| 15285 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15286 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15287 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15288 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15289 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15290 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15291 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15292 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15293 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15294 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15295 | |
| 15296 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15297 | #if 0 |
| 15298 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15299 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15300 | #endif |
| 15301 | { } /* end */ |
| 15302 | }; |
| 15303 | |
| 15304 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15305 | { 2, alc861_asus_ch2_init }, |
| 15306 | { 6, alc861_asus_ch6_init }, |
| 15307 | }; |
| 15308 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15309 | /* patch-ALC861 */ |
| 15310 | |
| 15311 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15312 | /* output mixer control */ |
| 15313 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15314 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15315 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15316 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15317 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15318 | |
| 15319 | /*Input mixer control */ |
| 15320 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15321 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15322 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15323 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15324 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15325 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15326 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15327 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15328 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15329 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15330 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15331 | { } /* end */ |
| 15332 | }; |
| 15333 | |
| 15334 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15335 | /* output mixer control */ |
| 15336 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15337 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15338 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15339 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15340 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15341 | |
| 15342 | /* Input mixer control */ |
| 15343 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15344 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15345 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15346 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15347 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15348 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15349 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15350 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15351 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15352 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15353 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15354 | { |
| 15355 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15356 | .name = "Channel Mode", |
| 15357 | .info = alc_ch_mode_info, |
| 15358 | .get = alc_ch_mode_get, |
| 15359 | .put = alc_ch_mode_put, |
| 15360 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15361 | }, |
| 15362 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15363 | }; |
| 15364 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15365 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15366 | /* output mixer control */ |
| 15367 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15368 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15369 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15370 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15371 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15372 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15373 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15374 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15375 | /* output mixer control */ |
| 15376 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15377 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15378 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15379 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15380 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15381 | |
| 15382 | /* Input mixer control */ |
| 15383 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15384 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15385 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15386 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15387 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15388 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15389 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15391 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15392 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15393 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15394 | { |
| 15395 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15396 | .name = "Channel Mode", |
| 15397 | .info = alc_ch_mode_info, |
| 15398 | .get = alc_ch_mode_get, |
| 15399 | .put = alc_ch_mode_put, |
| 15400 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15401 | }, |
| 15402 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15403 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15404 | |
| 15405 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15406 | /* output mixer control */ |
| 15407 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15408 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15409 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15410 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15411 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15412 | |
| 15413 | /* Input mixer control */ |
| 15414 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15415 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15416 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15417 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15418 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15419 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15420 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15421 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15422 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15423 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15424 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15425 | { |
| 15426 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15427 | .name = "Channel Mode", |
| 15428 | .info = alc_ch_mode_info, |
| 15429 | .get = alc_ch_mode_get, |
| 15430 | .put = alc_ch_mode_put, |
| 15431 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15432 | }, |
| 15433 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15434 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15435 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15436 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15437 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15438 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15439 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15440 | { } |
| 15441 | }; |
| 15442 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15443 | /* |
| 15444 | * generic initialization of ADC, input mixers and output mixers |
| 15445 | */ |
| 15446 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15447 | /* |
| 15448 | * Unmute ADC0 and set the default input to mic-in |
| 15449 | */ |
| 15450 | /* port-A for surround (rear panel) */ |
| 15451 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15452 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15453 | /* port-B for mic-in (rear panel) with vref */ |
| 15454 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15455 | /* port-C for line-in (rear panel) */ |
| 15456 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15457 | /* port-D for Front */ |
| 15458 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15459 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15460 | /* port-E for HP out (front panel) */ |
| 15461 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15462 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15463 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15464 | /* port-F for mic-in (front panel) with vref */ |
| 15465 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15466 | /* port-G for CLFE (rear panel) */ |
| 15467 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15468 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15469 | /* port-H for side (rear panel) */ |
| 15470 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15471 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15472 | /* CD-in */ |
| 15473 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15474 | /* route front mic to ADC1*/ |
| 15475 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15476 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15477 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15478 | /* Unmute DAC0~3 & spdif out*/ |
| 15479 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15480 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15481 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15482 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15483 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15484 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15485 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15486 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15487 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15488 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15489 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15490 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15491 | /* Unmute Stereo Mixer 15 */ |
| 15492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15493 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15494 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15495 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15496 | |
| 15497 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15498 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15499 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15500 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15502 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15503 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15504 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15505 | /* hp used DAC 3 (Front) */ |
| 15506 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15507 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15508 | |
| 15509 | { } |
| 15510 | }; |
| 15511 | |
| 15512 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15513 | /* |
| 15514 | * Unmute ADC0 and set the default input to mic-in |
| 15515 | */ |
| 15516 | /* port-A for surround (rear panel) */ |
| 15517 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15518 | /* port-B for mic-in (rear panel) with vref */ |
| 15519 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15520 | /* port-C for line-in (rear panel) */ |
| 15521 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15522 | /* port-D for Front */ |
| 15523 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15524 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15525 | /* port-E for HP out (front panel) */ |
| 15526 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15527 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15528 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15529 | /* port-F for mic-in (front panel) with vref */ |
| 15530 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15531 | /* port-G for CLFE (rear panel) */ |
| 15532 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15533 | /* port-H for side (rear panel) */ |
| 15534 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15535 | /* CD-in */ |
| 15536 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15537 | /* route front mic to ADC1*/ |
| 15538 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15539 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15540 | /* Unmute DAC0~3 & spdif out*/ |
| 15541 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15542 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15543 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15544 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15545 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15546 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15547 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15548 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15549 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15550 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15551 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15552 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15553 | /* Unmute Stereo Mixer 15 */ |
| 15554 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15555 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15556 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15557 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15558 | |
| 15559 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15560 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15561 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15562 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15563 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15564 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15565 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15566 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15567 | /* hp used DAC 3 (Front) */ |
| 15568 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15569 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15570 | { } |
| 15571 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15572 | |
| 15573 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15574 | /* |
| 15575 | * Unmute ADC0 and set the default input to mic-in |
| 15576 | */ |
| 15577 | /* port-A for surround (rear panel) */ |
| 15578 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15579 | /* port-B for mic-in (rear panel) with vref */ |
| 15580 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15581 | /* port-C for line-in (rear panel) */ |
| 15582 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15583 | /* port-D for Front */ |
| 15584 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15585 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15586 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15587 | /* this has to be set to VREF80 */ |
| 15588 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15589 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15590 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15591 | /* port-F for mic-in (front panel) with vref */ |
| 15592 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15593 | /* port-G for CLFE (rear panel) */ |
| 15594 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15595 | /* port-H for side (rear panel) */ |
| 15596 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15597 | /* CD-in */ |
| 15598 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15599 | /* route front mic to ADC1*/ |
| 15600 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15601 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15602 | /* Unmute DAC0~3 & spdif out*/ |
| 15603 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15604 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15605 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15606 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15607 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15608 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15609 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15610 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15611 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15612 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15613 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15614 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15615 | /* Unmute Stereo Mixer 15 */ |
| 15616 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15617 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15618 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15619 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15620 | |
| 15621 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15622 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15623 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15624 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15625 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15626 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15627 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15628 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15629 | /* hp used DAC 3 (Front) */ |
| 15630 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15631 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15632 | { } |
| 15633 | }; |
| 15634 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15635 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15636 | /* |
| 15637 | * Unmute ADC0 and set the default input to mic-in |
| 15638 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15639 | /* port-A for surround (rear panel) |
| 15640 | * according to codec#0 this is the HP jack |
| 15641 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15642 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15643 | /* route front PCM to HP */ |
| 15644 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15645 | /* port-B for mic-in (rear panel) with vref */ |
| 15646 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15647 | /* port-C for line-in (rear panel) */ |
| 15648 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15649 | /* port-D for Front */ |
| 15650 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15651 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15652 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15653 | /* this has to be set to VREF80 */ |
| 15654 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15655 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15656 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15657 | /* port-F for mic-in (front panel) with vref */ |
| 15658 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15659 | /* port-G for CLFE (rear panel) */ |
| 15660 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15661 | /* port-H for side (rear panel) */ |
| 15662 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15663 | /* CD-in */ |
| 15664 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15665 | /* route front mic to ADC1*/ |
| 15666 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15667 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15668 | /* Unmute DAC0~3 & spdif out*/ |
| 15669 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15670 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15671 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15672 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15673 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15674 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15675 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15676 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15677 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15678 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15679 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15680 | /* Unmute Stereo Mixer 15 */ |
| 15681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15682 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15685 | |
| 15686 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15687 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15688 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15689 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15690 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15691 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15692 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15693 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15694 | /* hp used DAC 3 (Front) */ |
| 15695 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15696 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15697 | { } |
| 15698 | }; |
| 15699 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15700 | /* additional init verbs for ASUS laptops */ |
| 15701 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15702 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15703 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15704 | { } |
| 15705 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15706 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15707 | /* |
| 15708 | * generic initialization of ADC, input mixers and output mixers |
| 15709 | */ |
| 15710 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15711 | /* |
| 15712 | * Unmute ADC0 and set the default input to mic-in |
| 15713 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15714 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15715 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15716 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15717 | /* Unmute DAC0~3 & spdif out*/ |
| 15718 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15719 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15720 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15721 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15722 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15723 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15724 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15725 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15726 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15727 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15728 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15729 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15730 | /* Unmute Stereo Mixer 15 */ |
| 15731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15732 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15733 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15734 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15735 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15736 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15737 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15738 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15739 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15741 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15743 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15744 | |
| 15745 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15746 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15747 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15748 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15749 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15750 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15751 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15752 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15753 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15754 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15755 | |
| 15756 | { } |
| 15757 | }; |
| 15758 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15759 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15760 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15761 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15762 | { } |
| 15763 | }; |
| 15764 | |
| 15765 | /* toggle speaker-output according to the hp-jack state */ |
| 15766 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15767 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15768 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15769 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15770 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15771 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15772 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15773 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15774 | } |
| 15775 | |
| 15776 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15777 | unsigned int res) |
| 15778 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15779 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15780 | alc861_toshiba_automute(codec); |
| 15781 | } |
| 15782 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15783 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15784 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15785 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15786 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15787 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15788 | |
| 15789 | |
| 15790 | #define ALC861_DIGOUT_NID 0x07 |
| 15791 | |
| 15792 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15793 | { 8, NULL } |
| 15794 | }; |
| 15795 | |
| 15796 | static hda_nid_t alc861_dac_nids[4] = { |
| 15797 | /* front, surround, clfe, side */ |
| 15798 | 0x03, 0x06, 0x05, 0x04 |
| 15799 | }; |
| 15800 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15801 | static hda_nid_t alc660_dac_nids[3] = { |
| 15802 | /* front, clfe, surround */ |
| 15803 | 0x03, 0x05, 0x06 |
| 15804 | }; |
| 15805 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15806 | static hda_nid_t alc861_adc_nids[1] = { |
| 15807 | /* ADC0-2 */ |
| 15808 | 0x08, |
| 15809 | }; |
| 15810 | |
| 15811 | static struct hda_input_mux alc861_capture_source = { |
| 15812 | .num_items = 5, |
| 15813 | .items = { |
| 15814 | { "Mic", 0x0 }, |
| 15815 | { "Front Mic", 0x3 }, |
| 15816 | { "Line", 0x1 }, |
| 15817 | { "CD", 0x4 }, |
| 15818 | { "Mixer", 0x5 }, |
| 15819 | }, |
| 15820 | }; |
| 15821 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15822 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15823 | { |
| 15824 | struct alc_spec *spec = codec->spec; |
| 15825 | hda_nid_t mix, srcs[5]; |
| 15826 | int i, j, num; |
| 15827 | |
| 15828 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15829 | return 0; |
| 15830 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15831 | if (num < 0) |
| 15832 | return 0; |
| 15833 | for (i = 0; i < num; i++) { |
| 15834 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15835 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15836 | if (type != AC_WID_AUD_OUT) |
| 15837 | continue; |
| 15838 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15839 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15840 | break; |
| 15841 | if (j >= spec->multiout.num_dacs) |
| 15842 | return srcs[i]; |
| 15843 | } |
| 15844 | return 0; |
| 15845 | } |
| 15846 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15847 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15848 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15849 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15850 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15851 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15852 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15853 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15854 | |
| 15855 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15856 | for (i = 0; i < cfg->line_outs; i++) { |
| 15857 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15858 | dac = alc861_look_for_dac(codec, nid); |
| 15859 | if (!dac) |
| 15860 | continue; |
| 15861 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15862 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15863 | return 0; |
| 15864 | } |
| 15865 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15866 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15867 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15868 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15869 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15870 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15871 | } |
| 15872 | |
| 15873 | /* add playback controls from the parsed DAC table */ |
| 15874 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15875 | const struct auto_pin_cfg *cfg) |
| 15876 | { |
| 15877 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15878 | static const char *chname[4] = { |
| 15879 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15880 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15881 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15882 | int i, err; |
| 15883 | |
| 15884 | if (cfg->line_outs == 1) { |
| 15885 | const char *pfx = NULL; |
| 15886 | if (!cfg->hp_outs) |
| 15887 | pfx = "Master"; |
| 15888 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15889 | pfx = "Speaker"; |
| 15890 | if (pfx) { |
| 15891 | nid = spec->multiout.dac_nids[0]; |
| 15892 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15893 | } |
| 15894 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15895 | |
| 15896 | for (i = 0; i < cfg->line_outs; i++) { |
| 15897 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15898 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15899 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15900 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15901 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15902 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15903 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15904 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15905 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15906 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15907 | return err; |
| 15908 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15909 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15910 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15911 | return err; |
| 15912 | } |
| 15913 | } |
| 15914 | return 0; |
| 15915 | } |
| 15916 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15917 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15918 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15919 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15920 | int err; |
| 15921 | hda_nid_t nid; |
| 15922 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15923 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15924 | return 0; |
| 15925 | |
| 15926 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15927 | nid = alc861_look_for_dac(codec, pin); |
| 15928 | if (nid) { |
| 15929 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15930 | if (err < 0) |
| 15931 | return err; |
| 15932 | spec->multiout.hp_nid = nid; |
| 15933 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15934 | } |
| 15935 | return 0; |
| 15936 | } |
| 15937 | |
| 15938 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15939 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15940 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15941 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15942 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15943 | } |
| 15944 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15945 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15946 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15947 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15948 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15949 | hda_nid_t mix, srcs[5]; |
| 15950 | int i, num; |
| 15951 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15952 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15953 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15954 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15955 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15956 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15957 | return; |
| 15958 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15959 | if (num < 0) |
| 15960 | return; |
| 15961 | for (i = 0; i < num; i++) { |
| 15962 | unsigned int mute; |
| 15963 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15964 | mute = AMP_IN_UNMUTE(i); |
| 15965 | else |
| 15966 | mute = AMP_IN_MUTE(i); |
| 15967 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15968 | mute); |
| 15969 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15970 | } |
| 15971 | |
| 15972 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15973 | { |
| 15974 | struct alc_spec *spec = codec->spec; |
| 15975 | int i; |
| 15976 | |
| 15977 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15978 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15979 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15980 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15981 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15982 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15983 | } |
| 15984 | } |
| 15985 | |
| 15986 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15987 | { |
| 15988 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15989 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15990 | if (spec->autocfg.hp_outs) |
| 15991 | alc861_auto_set_output_and_unmute(codec, |
| 15992 | spec->autocfg.hp_pins[0], |
| 15993 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15994 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15995 | if (spec->autocfg.speaker_outs) |
| 15996 | alc861_auto_set_output_and_unmute(codec, |
| 15997 | spec->autocfg.speaker_pins[0], |
| 15998 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15999 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16000 | } |
| 16001 | |
| 16002 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16003 | { |
| 16004 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16005 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16006 | int i; |
| 16007 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16008 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16009 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16010 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16011 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16012 | } |
| 16013 | } |
| 16014 | |
| 16015 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16016 | /* return 1 if successful, 0 if the proper config is not found, |
| 16017 | * or a negative error code |
| 16018 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16019 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16020 | { |
| 16021 | struct alc_spec *spec = codec->spec; |
| 16022 | int err; |
| 16023 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16024 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16025 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16026 | alc861_ignore); |
| 16027 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16028 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16029 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16030 | return 0; /* can't find valid BIOS pin config */ |
| 16031 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16032 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16033 | if (err < 0) |
| 16034 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16035 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16036 | if (err < 0) |
| 16037 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16038 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16039 | if (err < 0) |
| 16040 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16041 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16042 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16043 | return err; |
| 16044 | |
| 16045 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16046 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16047 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16048 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16049 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16050 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16051 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16052 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16053 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16054 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16055 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16056 | |
| 16057 | spec->adc_nids = alc861_adc_nids; |
| 16058 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16059 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16060 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16061 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16062 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16063 | return 1; |
| 16064 | } |
| 16065 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16066 | /* additional initialization for auto-configuration model */ |
| 16067 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16068 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16069 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16070 | alc861_auto_init_multi_out(codec); |
| 16071 | alc861_auto_init_hp_out(codec); |
| 16072 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16073 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16074 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16075 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16076 | } |
| 16077 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16078 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16079 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16080 | { 0x15, HDA_INPUT, 0 }, |
| 16081 | { 0x15, HDA_INPUT, 1 }, |
| 16082 | { 0x15, HDA_INPUT, 2 }, |
| 16083 | { 0x15, HDA_INPUT, 3 }, |
| 16084 | { } /* end */ |
| 16085 | }; |
| 16086 | #endif |
| 16087 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16088 | |
| 16089 | /* |
| 16090 | * configuration and preset |
| 16091 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16092 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 16093 | [ALC861_3ST] = "3stack", |
| 16094 | [ALC660_3ST] = "3stack-660", |
| 16095 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16096 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16097 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16098 | [ALC861_TOSHIBA] = "toshiba", |
| 16099 | [ALC861_ASUS] = "asus", |
| 16100 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16101 | [ALC861_AUTO] = "auto", |
| 16102 | }; |
| 16103 | |
| 16104 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16105 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16106 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16107 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16108 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16109 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16110 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16111 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16112 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16113 | * Any other models that need this preset? |
| 16114 | */ |
| 16115 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16116 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16117 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16118 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16119 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16120 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16121 | /* FIXME: the below seems conflict */ |
| 16122 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16123 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16124 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16125 | {} |
| 16126 | }; |
| 16127 | |
| 16128 | static struct alc_config_preset alc861_presets[] = { |
| 16129 | [ALC861_3ST] = { |
| 16130 | .mixers = { alc861_3ST_mixer }, |
| 16131 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16132 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16133 | .dac_nids = alc861_dac_nids, |
| 16134 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16135 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16136 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16137 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16138 | .adc_nids = alc861_adc_nids, |
| 16139 | .input_mux = &alc861_capture_source, |
| 16140 | }, |
| 16141 | [ALC861_3ST_DIG] = { |
| 16142 | .mixers = { alc861_base_mixer }, |
| 16143 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16144 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16145 | .dac_nids = alc861_dac_nids, |
| 16146 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16147 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16148 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16149 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16150 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16151 | .adc_nids = alc861_adc_nids, |
| 16152 | .input_mux = &alc861_capture_source, |
| 16153 | }, |
| 16154 | [ALC861_6ST_DIG] = { |
| 16155 | .mixers = { alc861_base_mixer }, |
| 16156 | .init_verbs = { alc861_base_init_verbs }, |
| 16157 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16158 | .dac_nids = alc861_dac_nids, |
| 16159 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16160 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16161 | .channel_mode = alc861_8ch_modes, |
| 16162 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16163 | .adc_nids = alc861_adc_nids, |
| 16164 | .input_mux = &alc861_capture_source, |
| 16165 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16166 | [ALC660_3ST] = { |
| 16167 | .mixers = { alc861_3ST_mixer }, |
| 16168 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16169 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16170 | .dac_nids = alc660_dac_nids, |
| 16171 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16172 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16173 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16174 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16175 | .adc_nids = alc861_adc_nids, |
| 16176 | .input_mux = &alc861_capture_source, |
| 16177 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16178 | [ALC861_UNIWILL_M31] = { |
| 16179 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16180 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16181 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16182 | .dac_nids = alc861_dac_nids, |
| 16183 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16184 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16185 | .channel_mode = alc861_uniwill_m31_modes, |
| 16186 | .need_dac_fix = 1, |
| 16187 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16188 | .adc_nids = alc861_adc_nids, |
| 16189 | .input_mux = &alc861_capture_source, |
| 16190 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16191 | [ALC861_TOSHIBA] = { |
| 16192 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16193 | .init_verbs = { alc861_base_init_verbs, |
| 16194 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16195 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16196 | .dac_nids = alc861_dac_nids, |
| 16197 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16198 | .channel_mode = alc883_3ST_2ch_modes, |
| 16199 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16200 | .adc_nids = alc861_adc_nids, |
| 16201 | .input_mux = &alc861_capture_source, |
| 16202 | .unsol_event = alc861_toshiba_unsol_event, |
| 16203 | .init_hook = alc861_toshiba_automute, |
| 16204 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16205 | [ALC861_ASUS] = { |
| 16206 | .mixers = { alc861_asus_mixer }, |
| 16207 | .init_verbs = { alc861_asus_init_verbs }, |
| 16208 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16209 | .dac_nids = alc861_dac_nids, |
| 16210 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16211 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16212 | .channel_mode = alc861_asus_modes, |
| 16213 | .need_dac_fix = 1, |
| 16214 | .hp_nid = 0x06, |
| 16215 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16216 | .adc_nids = alc861_adc_nids, |
| 16217 | .input_mux = &alc861_capture_source, |
| 16218 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16219 | [ALC861_ASUS_LAPTOP] = { |
| 16220 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16221 | .init_verbs = { alc861_asus_init_verbs, |
| 16222 | alc861_asus_laptop_init_verbs }, |
| 16223 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16224 | .dac_nids = alc861_dac_nids, |
| 16225 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16226 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16227 | .channel_mode = alc883_3ST_2ch_modes, |
| 16228 | .need_dac_fix = 1, |
| 16229 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16230 | .adc_nids = alc861_adc_nids, |
| 16231 | .input_mux = &alc861_capture_source, |
| 16232 | }, |
| 16233 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16234 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16235 | /* Pin config fixes */ |
| 16236 | enum { |
| 16237 | PINFIX_FSC_AMILO_PI1505, |
| 16238 | }; |
| 16239 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16240 | static const struct alc_fixup alc861_fixups[] = { |
| 16241 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16242 | .pins = (const struct alc_pincfg[]) { |
| 16243 | { 0x0b, 0x0221101f }, /* HP */ |
| 16244 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16245 | { } |
| 16246 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16247 | }, |
| 16248 | }; |
| 16249 | |
| 16250 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16251 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16252 | {} |
| 16253 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16254 | |
| 16255 | static int patch_alc861(struct hda_codec *codec) |
| 16256 | { |
| 16257 | struct alc_spec *spec; |
| 16258 | int board_config; |
| 16259 | int err; |
| 16260 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16261 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16262 | if (spec == NULL) |
| 16263 | return -ENOMEM; |
| 16264 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16265 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16266 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16267 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16268 | alc861_models, |
| 16269 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16270 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16271 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16272 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16273 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16274 | board_config = ALC861_AUTO; |
| 16275 | } |
| 16276 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16277 | if (board_config == ALC861_AUTO) |
| 16278 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16279 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16280 | if (board_config == ALC861_AUTO) { |
| 16281 | /* automatic parse from the BIOS config */ |
| 16282 | err = alc861_parse_auto_config(codec); |
| 16283 | if (err < 0) { |
| 16284 | alc_free(codec); |
| 16285 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16286 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16287 | printk(KERN_INFO |
| 16288 | "hda_codec: Cannot set up configuration " |
| 16289 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16290 | board_config = ALC861_3ST_DIG; |
| 16291 | } |
| 16292 | } |
| 16293 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16294 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16295 | if (err < 0) { |
| 16296 | alc_free(codec); |
| 16297 | return err; |
| 16298 | } |
| 16299 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16300 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16301 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16302 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16303 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16304 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16305 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16306 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16307 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16308 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16309 | if (!spec->cap_mixer) |
| 16310 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16311 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16312 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16313 | spec->vmaster_nid = 0x03; |
| 16314 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16315 | if (board_config == ALC861_AUTO) |
| 16316 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 16317 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16318 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16319 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16320 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16321 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16322 | spec->power_hook = alc_power_eapd; |
| 16323 | #endif |
| 16324 | } |
| 16325 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16326 | if (!spec->loopback.amplist) |
| 16327 | spec->loopback.amplist = alc861_loopbacks; |
| 16328 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16329 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16330 | return 0; |
| 16331 | } |
| 16332 | |
| 16333 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16334 | * ALC861-VD support |
| 16335 | * |
| 16336 | * Based on ALC882 |
| 16337 | * |
| 16338 | * In addition, an independent DAC |
| 16339 | */ |
| 16340 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16341 | |
| 16342 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16343 | /* front, surr, clfe, side surr */ |
| 16344 | 0x02, 0x03, 0x04, 0x05 |
| 16345 | }; |
| 16346 | |
| 16347 | /* dac_nids for ALC660vd are in a different order - according to |
| 16348 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16349 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16350 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16351 | * - and it is the same as in 861vd. |
| 16352 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16353 | */ |
| 16354 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16355 | /* front, rear, clfe, rear_surr */ |
| 16356 | 0x02, 0x04, 0x03 |
| 16357 | }; |
| 16358 | |
| 16359 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16360 | /* ADC0 */ |
| 16361 | 0x09, |
| 16362 | }; |
| 16363 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16364 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16365 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16366 | /* input MUX */ |
| 16367 | /* FIXME: should be a matrix-type input source selection */ |
| 16368 | static struct hda_input_mux alc861vd_capture_source = { |
| 16369 | .num_items = 4, |
| 16370 | .items = { |
| 16371 | { "Mic", 0x0 }, |
| 16372 | { "Front Mic", 0x1 }, |
| 16373 | { "Line", 0x2 }, |
| 16374 | { "CD", 0x4 }, |
| 16375 | }, |
| 16376 | }; |
| 16377 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16378 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16379 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16380 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16381 | { "Ext Mic", 0x0 }, |
| 16382 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16383 | }, |
| 16384 | }; |
| 16385 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16386 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16387 | .num_items = 2, |
| 16388 | .items = { |
| 16389 | { "Front Mic", 0x0 }, |
| 16390 | { "ATAPI Mic", 0x1 }, |
| 16391 | }, |
| 16392 | }; |
| 16393 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16394 | /* |
| 16395 | * 2ch mode |
| 16396 | */ |
| 16397 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16398 | { 2, NULL } |
| 16399 | }; |
| 16400 | |
| 16401 | /* |
| 16402 | * 6ch mode |
| 16403 | */ |
| 16404 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16405 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16406 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16407 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16408 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16409 | { } /* end */ |
| 16410 | }; |
| 16411 | |
| 16412 | /* |
| 16413 | * 8ch mode |
| 16414 | */ |
| 16415 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16416 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16417 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16418 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16419 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16420 | { } /* end */ |
| 16421 | }; |
| 16422 | |
| 16423 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16424 | { 6, alc861vd_6stack_ch6_init }, |
| 16425 | { 8, alc861vd_6stack_ch8_init }, |
| 16426 | }; |
| 16427 | |
| 16428 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16429 | { |
| 16430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16431 | .name = "Channel Mode", |
| 16432 | .info = alc_ch_mode_info, |
| 16433 | .get = alc_ch_mode_get, |
| 16434 | .put = alc_ch_mode_put, |
| 16435 | }, |
| 16436 | { } /* end */ |
| 16437 | }; |
| 16438 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16439 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16440 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16441 | */ |
| 16442 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16443 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16444 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16445 | |
| 16446 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16447 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16448 | |
| 16449 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16450 | HDA_OUTPUT), |
| 16451 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16452 | HDA_OUTPUT), |
| 16453 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16454 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16455 | |
| 16456 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16457 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16458 | |
| 16459 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16460 | |
| 16461 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16464 | |
| 16465 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16466 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16467 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16468 | |
| 16469 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16470 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16471 | |
| 16472 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16473 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16474 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16475 | { } /* end */ |
| 16476 | }; |
| 16477 | |
| 16478 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16479 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16480 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16481 | |
| 16482 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16483 | |
| 16484 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16485 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16486 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16487 | |
| 16488 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16489 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16490 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16491 | |
| 16492 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16493 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16494 | |
| 16495 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16496 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16497 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16498 | { } /* end */ |
| 16499 | }; |
| 16500 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16501 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16502 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16503 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16504 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16505 | |
| 16506 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16507 | |
| 16508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16509 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16510 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16511 | |
| 16512 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16513 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16514 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16515 | |
| 16516 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16517 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16518 | |
| 16519 | { } /* end */ |
| 16520 | }; |
| 16521 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16522 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 16523 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16524 | */ |
| 16525 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16526 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16527 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16528 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16529 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16530 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16531 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16532 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16533 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16534 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16535 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16536 | { } /* end */ |
| 16537 | }; |
| 16538 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16539 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16540 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16541 | */ |
| 16542 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16543 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16544 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16545 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16546 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16547 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16548 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16549 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16550 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16551 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16552 | { } /* end */ |
| 16553 | }; |
| 16554 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16555 | /* |
| 16556 | * generic initialization of ADC, input mixers and output mixers |
| 16557 | */ |
| 16558 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16559 | /* |
| 16560 | * Unmute ADC0 and set the default input to mic-in |
| 16561 | */ |
| 16562 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16564 | |
| 16565 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16566 | * the analog-loopback mixer widget |
| 16567 | */ |
| 16568 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16574 | |
| 16575 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16576 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16577 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16580 | |
| 16581 | /* |
| 16582 | * Set up output mixers (0x02 - 0x05) |
| 16583 | */ |
| 16584 | /* set vol=0 to output mixers */ |
| 16585 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16586 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16587 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16588 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16589 | |
| 16590 | /* set up input amps for analog loopback */ |
| 16591 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16594 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16595 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16596 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16597 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16598 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16599 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16600 | |
| 16601 | { } |
| 16602 | }; |
| 16603 | |
| 16604 | /* |
| 16605 | * 3-stack pin configuration: |
| 16606 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16607 | */ |
| 16608 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16609 | /* |
| 16610 | * Set pin mode and muting |
| 16611 | */ |
| 16612 | /* set front pin widgets 0x14 for output */ |
| 16613 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16614 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16615 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16616 | |
| 16617 | /* Mic (rear) pin: input vref at 80% */ |
| 16618 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16619 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16620 | /* Front Mic pin: input vref at 80% */ |
| 16621 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16622 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16623 | /* Line In pin: input */ |
| 16624 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16625 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16626 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16627 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16628 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16629 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16630 | /* CD pin widget for input */ |
| 16631 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16632 | |
| 16633 | { } |
| 16634 | }; |
| 16635 | |
| 16636 | /* |
| 16637 | * 6-stack pin configuration: |
| 16638 | */ |
| 16639 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16640 | /* |
| 16641 | * Set pin mode and muting |
| 16642 | */ |
| 16643 | /* set front pin widgets 0x14 for output */ |
| 16644 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16645 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16646 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16647 | |
| 16648 | /* Rear Pin: output 1 (0x0d) */ |
| 16649 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16651 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16652 | /* CLFE Pin: output 2 (0x0e) */ |
| 16653 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16654 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16655 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16656 | /* Side Pin: output 3 (0x0f) */ |
| 16657 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16658 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16659 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16660 | |
| 16661 | /* Mic (rear) pin: input vref at 80% */ |
| 16662 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16663 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16664 | /* Front Mic pin: input vref at 80% */ |
| 16665 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16666 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16667 | /* Line In pin: input */ |
| 16668 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16669 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16670 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16671 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16672 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16673 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16674 | /* CD pin widget for input */ |
| 16675 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16676 | |
| 16677 | { } |
| 16678 | }; |
| 16679 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16680 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16681 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16682 | { } |
| 16683 | }; |
| 16684 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16685 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16686 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16687 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16688 | { } |
| 16689 | }; |
| 16690 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16691 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16692 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16693 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16694 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16695 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16696 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16697 | {} |
| 16698 | }; |
| 16699 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16700 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16701 | { |
| 16702 | unsigned int present; |
| 16703 | unsigned char bits; |
| 16704 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16705 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16706 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16707 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16708 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16709 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16710 | } |
| 16711 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16712 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16713 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16714 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16715 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16716 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16717 | } |
| 16718 | |
| 16719 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16720 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16721 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16722 | alc861vd_lenovo_mic_automute(codec); |
| 16723 | } |
| 16724 | |
| 16725 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16726 | unsigned int res) |
| 16727 | { |
| 16728 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16729 | case ALC880_MIC_EVENT: |
| 16730 | alc861vd_lenovo_mic_automute(codec); |
| 16731 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16732 | default: |
| 16733 | alc_automute_amp_unsol_event(codec, res); |
| 16734 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16735 | } |
| 16736 | } |
| 16737 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16738 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16739 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16740 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16741 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16742 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16743 | |
| 16744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16746 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16747 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16748 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16750 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16752 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16753 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16754 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16756 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16757 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16758 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16759 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16760 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16761 | |
| 16762 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16763 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16766 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16767 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16768 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16769 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16770 | |
| 16771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16772 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16775 | |
| 16776 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16777 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16778 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16779 | |
| 16780 | { } /* end */ |
| 16781 | }; |
| 16782 | |
| 16783 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16784 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16785 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16786 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16787 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16788 | spec->autocfg.hp_pins[0] = 0x15; |
| 16789 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16790 | } |
| 16791 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16792 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16793 | #define alc861vd_loopbacks alc880_loopbacks |
| 16794 | #endif |
| 16795 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16796 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16797 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16798 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16799 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16800 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16801 | |
| 16802 | /* |
| 16803 | * configuration and preset |
| 16804 | */ |
| 16805 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16806 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16807 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16808 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16809 | [ALC861VD_3ST] = "3stack", |
| 16810 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16811 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16812 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16813 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16814 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16815 | [ALC861VD_AUTO] = "auto", |
| 16816 | }; |
| 16817 | |
| 16818 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16819 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16820 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16821 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16822 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16823 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16824 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16825 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16826 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16827 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16828 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16829 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16830 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16831 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16832 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16833 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16834 | {} |
| 16835 | }; |
| 16836 | |
| 16837 | static struct alc_config_preset alc861vd_presets[] = { |
| 16838 | [ALC660VD_3ST] = { |
| 16839 | .mixers = { alc861vd_3st_mixer }, |
| 16840 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16841 | alc861vd_3stack_init_verbs }, |
| 16842 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16843 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16844 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16845 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16846 | .input_mux = &alc861vd_capture_source, |
| 16847 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16848 | [ALC660VD_3ST_DIG] = { |
| 16849 | .mixers = { alc861vd_3st_mixer }, |
| 16850 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16851 | alc861vd_3stack_init_verbs }, |
| 16852 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16853 | .dac_nids = alc660vd_dac_nids, |
| 16854 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16855 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16856 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16857 | .input_mux = &alc861vd_capture_source, |
| 16858 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16859 | [ALC861VD_3ST] = { |
| 16860 | .mixers = { alc861vd_3st_mixer }, |
| 16861 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16862 | alc861vd_3stack_init_verbs }, |
| 16863 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16864 | .dac_nids = alc861vd_dac_nids, |
| 16865 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16866 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16867 | .input_mux = &alc861vd_capture_source, |
| 16868 | }, |
| 16869 | [ALC861VD_3ST_DIG] = { |
| 16870 | .mixers = { alc861vd_3st_mixer }, |
| 16871 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16872 | alc861vd_3stack_init_verbs }, |
| 16873 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16874 | .dac_nids = alc861vd_dac_nids, |
| 16875 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16876 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16877 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16878 | .input_mux = &alc861vd_capture_source, |
| 16879 | }, |
| 16880 | [ALC861VD_6ST_DIG] = { |
| 16881 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16882 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16883 | alc861vd_6stack_init_verbs }, |
| 16884 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16885 | .dac_nids = alc861vd_dac_nids, |
| 16886 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16887 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16888 | .channel_mode = alc861vd_6stack_modes, |
| 16889 | .input_mux = &alc861vd_capture_source, |
| 16890 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16891 | [ALC861VD_LENOVO] = { |
| 16892 | .mixers = { alc861vd_lenovo_mixer }, |
| 16893 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16894 | alc861vd_3stack_init_verbs, |
| 16895 | alc861vd_eapd_verbs, |
| 16896 | alc861vd_lenovo_unsol_verbs }, |
| 16897 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16898 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16899 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16900 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16901 | .input_mux = &alc861vd_capture_source, |
| 16902 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16903 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16904 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16905 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16906 | [ALC861VD_DALLAS] = { |
| 16907 | .mixers = { alc861vd_dallas_mixer }, |
| 16908 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16909 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16910 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16911 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16912 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16913 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16914 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16915 | .setup = alc861vd_dallas_setup, |
| 16916 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16917 | }, |
| 16918 | [ALC861VD_HP] = { |
| 16919 | .mixers = { alc861vd_hp_mixer }, |
| 16920 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16921 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16922 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16923 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16924 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16925 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16926 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16927 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16928 | .setup = alc861vd_dallas_setup, |
| 16929 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16930 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16931 | [ALC660VD_ASUS_V1S] = { |
| 16932 | .mixers = { alc861vd_lenovo_mixer }, |
| 16933 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16934 | alc861vd_3stack_init_verbs, |
| 16935 | alc861vd_eapd_verbs, |
| 16936 | alc861vd_lenovo_unsol_verbs }, |
| 16937 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16938 | .dac_nids = alc660vd_dac_nids, |
| 16939 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16940 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16941 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16942 | .input_mux = &alc861vd_capture_source, |
| 16943 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16944 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16945 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16946 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16947 | }; |
| 16948 | |
| 16949 | /* |
| 16950 | * BIOS auto configuration |
| 16951 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16952 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16953 | const struct auto_pin_cfg *cfg) |
| 16954 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 16955 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16956 | } |
| 16957 | |
| 16958 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16959 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16960 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16961 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16962 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16963 | } |
| 16964 | |
| 16965 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16966 | { |
| 16967 | struct alc_spec *spec = codec->spec; |
| 16968 | int i; |
| 16969 | |
| 16970 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16971 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16972 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16973 | if (nid) |
| 16974 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16975 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16976 | } |
| 16977 | } |
| 16978 | |
| 16979 | |
| 16980 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16981 | { |
| 16982 | struct alc_spec *spec = codec->spec; |
| 16983 | hda_nid_t pin; |
| 16984 | |
| 16985 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16986 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16987 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16988 | pin = spec->autocfg.speaker_pins[0]; |
| 16989 | if (pin) |
| 16990 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16991 | } |
| 16992 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16993 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16994 | |
| 16995 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16996 | { |
| 16997 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16998 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16999 | int i; |
| 17000 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17001 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17002 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17003 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17004 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17005 | if (nid != ALC861VD_PIN_CD_NID && |
| 17006 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17007 | snd_hda_codec_write(codec, nid, 0, |
| 17008 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17009 | AMP_OUT_MUTE); |
| 17010 | } |
| 17011 | } |
| 17012 | } |
| 17013 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17014 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17015 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17016 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17017 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17018 | |
| 17019 | /* add playback controls from the parsed DAC table */ |
| 17020 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17021 | * different NIDs for mute/unmute switch and volume control */ |
| 17022 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17023 | const struct auto_pin_cfg *cfg) |
| 17024 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17025 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 17026 | hda_nid_t nid_v, nid_s; |
| 17027 | int i, err; |
| 17028 | |
| 17029 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17030 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17031 | continue; |
| 17032 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17033 | alc880_dac_to_idx( |
| 17034 | spec->multiout.dac_nids[i])); |
| 17035 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17036 | alc880_dac_to_idx( |
| 17037 | spec->multiout.dac_nids[i])); |
| 17038 | |
| 17039 | if (i == 2) { |
| 17040 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17041 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17042 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17043 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17044 | HDA_OUTPUT)); |
| 17045 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17046 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17047 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17048 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17049 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17050 | HDA_OUTPUT)); |
| 17051 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17052 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17053 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17054 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17055 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17056 | HDA_INPUT)); |
| 17057 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17058 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17059 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17060 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17061 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17062 | HDA_INPUT)); |
| 17063 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17064 | return err; |
| 17065 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 17066 | const char *pfx; |
| 17067 | if (cfg->line_outs == 1 && |
| 17068 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 17069 | if (!cfg->hp_pins) |
| 17070 | pfx = "Speaker"; |
| 17071 | else |
| 17072 | pfx = "PCM"; |
| 17073 | } else |
| 17074 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17075 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17076 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17077 | HDA_OUTPUT)); |
| 17078 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17079 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 17080 | if (cfg->line_outs == 1 && |
| 17081 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17082 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17083 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17084 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17085 | HDA_INPUT)); |
| 17086 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17087 | return err; |
| 17088 | } |
| 17089 | } |
| 17090 | return 0; |
| 17091 | } |
| 17092 | |
| 17093 | /* add playback controls for speaker and HP outputs */ |
| 17094 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17095 | * different NIDs for mute/unmute switch and volume control */ |
| 17096 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17097 | hda_nid_t pin, const char *pfx) |
| 17098 | { |
| 17099 | hda_nid_t nid_v, nid_s; |
| 17100 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17101 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17102 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17103 | return 0; |
| 17104 | |
| 17105 | if (alc880_is_fixed_pin(pin)) { |
| 17106 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17107 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17108 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17109 | spec->multiout.hp_nid = nid_v; |
| 17110 | else |
| 17111 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17112 | /* control HP volume/switch on the output mixer amp */ |
| 17113 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17114 | alc880_fixed_pin_idx(pin)); |
| 17115 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17116 | alc880_fixed_pin_idx(pin)); |
| 17117 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17118 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17119 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17120 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17121 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17122 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17123 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17124 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17125 | return err; |
| 17126 | } else if (alc880_is_multi_pin(pin)) { |
| 17127 | /* set manual connection */ |
| 17128 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17129 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17130 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17131 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17132 | return err; |
| 17133 | } |
| 17134 | return 0; |
| 17135 | } |
| 17136 | |
| 17137 | /* parse the BIOS configuration and set up the alc_spec |
| 17138 | * return 1 if successful, 0 if the proper config is not found, |
| 17139 | * or a negative error code |
| 17140 | * Based on ALC880 version - had to change it to override |
| 17141 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17142 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17143 | { |
| 17144 | struct alc_spec *spec = codec->spec; |
| 17145 | int err; |
| 17146 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17147 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17148 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17149 | alc861vd_ignore); |
| 17150 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17151 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17152 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17153 | return 0; /* can't find valid BIOS pin config */ |
| 17154 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17155 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17156 | if (err < 0) |
| 17157 | return err; |
| 17158 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17159 | if (err < 0) |
| 17160 | return err; |
| 17161 | err = alc861vd_auto_create_extra_out(spec, |
| 17162 | spec->autocfg.speaker_pins[0], |
| 17163 | "Speaker"); |
| 17164 | if (err < 0) |
| 17165 | return err; |
| 17166 | err = alc861vd_auto_create_extra_out(spec, |
| 17167 | spec->autocfg.hp_pins[0], |
| 17168 | "Headphone"); |
| 17169 | if (err < 0) |
| 17170 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17171 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17172 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17173 | return err; |
| 17174 | |
| 17175 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17176 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17177 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17178 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17179 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17180 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17181 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17182 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17183 | |
| 17184 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17185 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17186 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17187 | err = alc_auto_add_mic_boost(codec); |
| 17188 | if (err < 0) |
| 17189 | return err; |
| 17190 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17191 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17192 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17193 | return 1; |
| 17194 | } |
| 17195 | |
| 17196 | /* additional initialization for auto-configuration model */ |
| 17197 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17198 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17199 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17200 | alc861vd_auto_init_multi_out(codec); |
| 17201 | alc861vd_auto_init_hp_out(codec); |
| 17202 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17203 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17204 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17205 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17206 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17207 | } |
| 17208 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17209 | enum { |
| 17210 | ALC660VD_FIX_ASUS_GPIO1 |
| 17211 | }; |
| 17212 | |
| 17213 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17214 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17215 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17216 | .verbs = (const struct hda_verb[]) { |
| 17217 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17218 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17219 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17220 | { } |
| 17221 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17222 | }, |
| 17223 | }; |
| 17224 | |
| 17225 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17226 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17227 | {} |
| 17228 | }; |
| 17229 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17230 | static int patch_alc861vd(struct hda_codec *codec) |
| 17231 | { |
| 17232 | struct alc_spec *spec; |
| 17233 | int err, board_config; |
| 17234 | |
| 17235 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17236 | if (spec == NULL) |
| 17237 | return -ENOMEM; |
| 17238 | |
| 17239 | codec->spec = spec; |
| 17240 | |
| 17241 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17242 | alc861vd_models, |
| 17243 | alc861vd_cfg_tbl); |
| 17244 | |
| 17245 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17246 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17247 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17248 | board_config = ALC861VD_AUTO; |
| 17249 | } |
| 17250 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17251 | if (board_config == ALC861VD_AUTO) |
| 17252 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17253 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17254 | if (board_config == ALC861VD_AUTO) { |
| 17255 | /* automatic parse from the BIOS config */ |
| 17256 | err = alc861vd_parse_auto_config(codec); |
| 17257 | if (err < 0) { |
| 17258 | alc_free(codec); |
| 17259 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17260 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17261 | printk(KERN_INFO |
| 17262 | "hda_codec: Cannot set up configuration " |
| 17263 | "from BIOS. Using base mode...\n"); |
| 17264 | board_config = ALC861VD_3ST; |
| 17265 | } |
| 17266 | } |
| 17267 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17268 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17269 | if (err < 0) { |
| 17270 | alc_free(codec); |
| 17271 | return err; |
| 17272 | } |
| 17273 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17274 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17275 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17276 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17277 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17278 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17279 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17280 | } |
| 17281 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17282 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17283 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17284 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17285 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17286 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17287 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17288 | if (!spec->adc_nids) { |
| 17289 | spec->adc_nids = alc861vd_adc_nids; |
| 17290 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17291 | } |
| 17292 | if (!spec->capsrc_nids) |
| 17293 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17294 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17295 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17296 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17297 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17298 | spec->vmaster_nid = 0x02; |
| 17299 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17300 | if (board_config == ALC861VD_AUTO) |
| 17301 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 17302 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17303 | codec->patch_ops = alc_patch_ops; |
| 17304 | |
| 17305 | if (board_config == ALC861VD_AUTO) |
| 17306 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17307 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17308 | if (!spec->loopback.amplist) |
| 17309 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17310 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17311 | |
| 17312 | return 0; |
| 17313 | } |
| 17314 | |
| 17315 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17316 | * ALC662 support |
| 17317 | * |
| 17318 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17319 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17320 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17321 | * 6-channel independent captures. |
| 17322 | * |
| 17323 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17324 | * driver yet). |
| 17325 | */ |
| 17326 | #define ALC662_DIGOUT_NID 0x06 |
| 17327 | #define ALC662_DIGIN_NID 0x0a |
| 17328 | |
| 17329 | static hda_nid_t alc662_dac_nids[4] = { |
| 17330 | /* front, rear, clfe, rear_surr */ |
| 17331 | 0x02, 0x03, 0x04 |
| 17332 | }; |
| 17333 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17334 | static hda_nid_t alc272_dac_nids[2] = { |
| 17335 | 0x02, 0x03 |
| 17336 | }; |
| 17337 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17338 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17339 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17340 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17341 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17342 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17343 | static hda_nid_t alc272_adc_nids[1] = { |
| 17344 | /* ADC1-2 */ |
| 17345 | 0x08, |
| 17346 | }; |
| 17347 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17348 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17349 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17350 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17351 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17352 | /* input MUX */ |
| 17353 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17354 | static struct hda_input_mux alc662_capture_source = { |
| 17355 | .num_items = 4, |
| 17356 | .items = { |
| 17357 | { "Mic", 0x0 }, |
| 17358 | { "Front Mic", 0x1 }, |
| 17359 | { "Line", 0x2 }, |
| 17360 | { "CD", 0x4 }, |
| 17361 | }, |
| 17362 | }; |
| 17363 | |
| 17364 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17365 | .num_items = 2, |
| 17366 | .items = { |
| 17367 | { "Mic", 0x1 }, |
| 17368 | { "Line", 0x2 }, |
| 17369 | }, |
| 17370 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17371 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17372 | static struct hda_input_mux alc663_capture_source = { |
| 17373 | .num_items = 3, |
| 17374 | .items = { |
| 17375 | { "Mic", 0x0 }, |
| 17376 | { "Front Mic", 0x1 }, |
| 17377 | { "Line", 0x2 }, |
| 17378 | }, |
| 17379 | }; |
| 17380 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17381 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17382 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17383 | .num_items = 16, |
| 17384 | .items = { |
| 17385 | { "Autoselect Mic", 0x0 }, |
| 17386 | { "Internal Mic", 0x1 }, |
| 17387 | { "In-0x02", 0x2 }, |
| 17388 | { "In-0x03", 0x3 }, |
| 17389 | { "In-0x04", 0x4 }, |
| 17390 | { "In-0x05", 0x5 }, |
| 17391 | { "In-0x06", 0x6 }, |
| 17392 | { "In-0x07", 0x7 }, |
| 17393 | { "In-0x08", 0x8 }, |
| 17394 | { "In-0x09", 0x9 }, |
| 17395 | { "In-0x0a", 0x0a }, |
| 17396 | { "In-0x0b", 0x0b }, |
| 17397 | { "In-0x0c", 0x0c }, |
| 17398 | { "In-0x0d", 0x0d }, |
| 17399 | { "In-0x0e", 0x0e }, |
| 17400 | { "In-0x0f", 0x0f }, |
| 17401 | }, |
| 17402 | }; |
| 17403 | #endif |
| 17404 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17405 | /* |
| 17406 | * 2ch mode |
| 17407 | */ |
| 17408 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17409 | { 2, NULL } |
| 17410 | }; |
| 17411 | |
| 17412 | /* |
| 17413 | * 2ch mode |
| 17414 | */ |
| 17415 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17416 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17417 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17418 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17419 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17420 | { } /* end */ |
| 17421 | }; |
| 17422 | |
| 17423 | /* |
| 17424 | * 6ch mode |
| 17425 | */ |
| 17426 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17427 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17428 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17429 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17430 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17431 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17432 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17433 | { } /* end */ |
| 17434 | }; |
| 17435 | |
| 17436 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17437 | { 2, alc662_3ST_ch2_init }, |
| 17438 | { 6, alc662_3ST_ch6_init }, |
| 17439 | }; |
| 17440 | |
| 17441 | /* |
| 17442 | * 2ch mode |
| 17443 | */ |
| 17444 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17445 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17446 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17447 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17448 | { } /* end */ |
| 17449 | }; |
| 17450 | |
| 17451 | /* |
| 17452 | * 6ch mode |
| 17453 | */ |
| 17454 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17455 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17456 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17457 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17458 | { } /* end */ |
| 17459 | }; |
| 17460 | |
| 17461 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17462 | { 2, alc662_sixstack_ch6_init }, |
| 17463 | { 6, alc662_sixstack_ch8_init }, |
| 17464 | }; |
| 17465 | |
| 17466 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17467 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17468 | */ |
| 17469 | |
| 17470 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17471 | /* output mixer control */ |
| 17472 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17473 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17474 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17475 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17476 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17477 | 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] | 17478 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17479 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17480 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17481 | |
| 17482 | /*Input mixer control */ |
| 17483 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17484 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17485 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17486 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17487 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17488 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17489 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17490 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17491 | { } /* end */ |
| 17492 | }; |
| 17493 | |
| 17494 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17495 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17496 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17497 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17498 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17499 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17500 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17501 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17502 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17503 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17504 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17505 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17506 | { } /* end */ |
| 17507 | }; |
| 17508 | |
| 17509 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17510 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17511 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17512 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17513 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17514 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17515 | 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] | 17516 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17517 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17518 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17519 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17520 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17521 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17522 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17523 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17524 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17525 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17526 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17527 | { } /* end */ |
| 17528 | }; |
| 17529 | |
| 17530 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17531 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17532 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17533 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17534 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17535 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17536 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17537 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17538 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17539 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17540 | { } /* end */ |
| 17541 | }; |
| 17542 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17543 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17544 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17545 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17546 | |
| 17547 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17548 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17549 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17550 | |
| 17551 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17552 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17553 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17554 | { } /* end */ |
| 17555 | }; |
| 17556 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17557 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17558 | ALC262_HIPPO_MASTER_SWITCH, |
| 17559 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17560 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17561 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17562 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17563 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17564 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17565 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17566 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17567 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17568 | { } /* end */ |
| 17569 | }; |
| 17570 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17571 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17572 | .ops = &snd_hda_bind_vol, |
| 17573 | .values = { |
| 17574 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17575 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17576 | 0 |
| 17577 | }, |
| 17578 | }; |
| 17579 | |
| 17580 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17581 | .ops = &snd_hda_bind_sw, |
| 17582 | .values = { |
| 17583 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17584 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17585 | 0 |
| 17586 | }, |
| 17587 | }; |
| 17588 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17589 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17590 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17591 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17593 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17594 | { } /* end */ |
| 17595 | }; |
| 17596 | |
| 17597 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17598 | .ops = &snd_hda_bind_sw, |
| 17599 | .values = { |
| 17600 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17601 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17602 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17603 | 0 |
| 17604 | }, |
| 17605 | }; |
| 17606 | |
| 17607 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17608 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17609 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17610 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17611 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17612 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17613 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17614 | |
| 17615 | { } /* end */ |
| 17616 | }; |
| 17617 | |
| 17618 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17619 | .ops = &snd_hda_bind_sw, |
| 17620 | .values = { |
| 17621 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17622 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17623 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17624 | 0 |
| 17625 | }, |
| 17626 | }; |
| 17627 | |
| 17628 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17629 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17630 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17633 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17634 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17635 | { } /* end */ |
| 17636 | }; |
| 17637 | |
| 17638 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17639 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17640 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17641 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17644 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17645 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17646 | { } /* end */ |
| 17647 | }; |
| 17648 | |
| 17649 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17650 | .ops = &snd_hda_bind_vol, |
| 17651 | .values = { |
| 17652 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17653 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17654 | 0 |
| 17655 | }, |
| 17656 | }; |
| 17657 | |
| 17658 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17659 | .ops = &snd_hda_bind_sw, |
| 17660 | .values = { |
| 17661 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17662 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17663 | 0 |
| 17664 | }, |
| 17665 | }; |
| 17666 | |
| 17667 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17668 | HDA_BIND_VOL("Master Playback Volume", |
| 17669 | &alc663_asus_two_bind_master_vol), |
| 17670 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17671 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17672 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17675 | { } /* end */ |
| 17676 | }; |
| 17677 | |
| 17678 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17679 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17680 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17681 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17682 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17683 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17684 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17685 | { } /* end */ |
| 17686 | }; |
| 17687 | |
| 17688 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17689 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17690 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17691 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17692 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17693 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17694 | |
| 17695 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17696 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17697 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17698 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17699 | { } /* end */ |
| 17700 | }; |
| 17701 | |
| 17702 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17703 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17704 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17705 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17706 | |
| 17707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17709 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17710 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17711 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17712 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17713 | { } /* end */ |
| 17714 | }; |
| 17715 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17716 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17717 | .ops = &snd_hda_bind_sw, |
| 17718 | .values = { |
| 17719 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17720 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17721 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17722 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17723 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17724 | 0 |
| 17725 | }, |
| 17726 | }; |
| 17727 | |
| 17728 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17729 | .ops = &snd_hda_bind_sw, |
| 17730 | .values = { |
| 17731 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17732 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17733 | 0 |
| 17734 | }, |
| 17735 | }; |
| 17736 | |
| 17737 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17738 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17739 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17740 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17741 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17742 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17743 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17744 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17745 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17746 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17747 | { } /* end */ |
| 17748 | }; |
| 17749 | |
| 17750 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17751 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17752 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17753 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17754 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17755 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17756 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17757 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17758 | { } /* end */ |
| 17759 | }; |
| 17760 | |
| 17761 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17762 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17763 | { |
| 17764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17765 | .name = "Channel Mode", |
| 17766 | .info = alc_ch_mode_info, |
| 17767 | .get = alc_ch_mode_get, |
| 17768 | .put = alc_ch_mode_put, |
| 17769 | }, |
| 17770 | { } /* end */ |
| 17771 | }; |
| 17772 | |
| 17773 | static struct hda_verb alc662_init_verbs[] = { |
| 17774 | /* ADC: mute amp left and right */ |
| 17775 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17776 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17777 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17780 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17781 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17782 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17783 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17784 | |
| 17785 | /* Front Pin: output 0 (0x0c) */ |
| 17786 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17787 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17788 | |
| 17789 | /* Rear Pin: output 1 (0x0d) */ |
| 17790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17792 | |
| 17793 | /* CLFE Pin: output 2 (0x0e) */ |
| 17794 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17795 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17796 | |
| 17797 | /* Mic (rear) pin: input vref at 80% */ |
| 17798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17800 | /* Front Mic pin: input vref at 80% */ |
| 17801 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17802 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17803 | /* Line In pin: input */ |
| 17804 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17806 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17807 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17808 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17809 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17810 | /* CD pin widget for input */ |
| 17811 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17812 | |
| 17813 | /* FIXME: use matrix-type input source selection */ |
| 17814 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17815 | /* Input mixer */ |
| 17816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17817 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17818 | |
| 17819 | /* always trun on EAPD */ |
| 17820 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17821 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17822 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17823 | { } |
| 17824 | }; |
| 17825 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17826 | static struct hda_verb alc663_init_verbs[] = { |
| 17827 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17828 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17829 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17830 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17831 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17832 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17833 | { } |
| 17834 | }; |
| 17835 | |
| 17836 | static struct hda_verb alc272_init_verbs[] = { |
| 17837 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17838 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17839 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17840 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17841 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17842 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17843 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17844 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17845 | { } |
| 17846 | }; |
| 17847 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17848 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17849 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17850 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17851 | {} |
| 17852 | }; |
| 17853 | |
| 17854 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17855 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17856 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17857 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17858 | }; |
| 17859 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17860 | /* Set Unsolicited Event*/ |
| 17861 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17862 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17863 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17864 | {} |
| 17865 | }; |
| 17866 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17867 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17868 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17869 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17870 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17871 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17872 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17874 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17875 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17876 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17877 | {} |
| 17878 | }; |
| 17879 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17880 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17881 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17882 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17883 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17884 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17885 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17886 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17887 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17888 | {} |
| 17889 | }; |
| 17890 | |
| 17891 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17892 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17893 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17894 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17895 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17896 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17897 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17898 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17899 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17900 | {} |
| 17901 | }; |
| 17902 | |
| 17903 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17904 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17906 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17908 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17909 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17910 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17911 | {} |
| 17912 | }; |
| 17913 | |
| 17914 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17915 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17916 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17917 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17918 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17919 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17920 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17921 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17922 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17923 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17924 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17925 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17926 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17927 | {} |
| 17928 | }; |
| 17929 | |
| 17930 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17931 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17932 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17933 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17934 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17935 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17936 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17937 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17938 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17939 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17940 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17941 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17942 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17943 | {} |
| 17944 | }; |
| 17945 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17946 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17947 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17948 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17949 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17950 | |
| 17951 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17952 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17953 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17954 | |
| 17955 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17956 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17957 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17958 | {} |
| 17959 | }; |
| 17960 | |
| 17961 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17962 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17963 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17964 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17965 | |
| 17966 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17967 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17968 | {} |
| 17969 | }; |
| 17970 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17971 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17972 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17973 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17974 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17975 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17976 | {} |
| 17977 | }; |
| 17978 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17979 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17980 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17981 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17982 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17983 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17984 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17985 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17986 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17989 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17990 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17991 | {} |
| 17992 | }; |
| 17993 | |
| 17994 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17995 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17996 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17997 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17998 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17999 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18000 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18001 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18002 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18003 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18004 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18005 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18006 | {} |
| 18007 | }; |
| 18008 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18009 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18010 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18011 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18012 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18013 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18014 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18015 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18016 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18017 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18018 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18019 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18020 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18021 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18022 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18023 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18024 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18025 | {} |
| 18026 | }; |
| 18027 | |
| 18028 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18029 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18030 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18031 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18032 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18033 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18034 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18035 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18036 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18037 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18038 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18039 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18040 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18041 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18042 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18043 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18044 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18045 | {} |
| 18046 | }; |
| 18047 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18048 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18049 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18050 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18051 | { } /* end */ |
| 18052 | }; |
| 18053 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18054 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18055 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18056 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18057 | { } /* end */ |
| 18058 | }; |
| 18059 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18060 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18061 | { |
| 18062 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18063 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18064 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18065 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18066 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18067 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18068 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18069 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18070 | } |
| 18071 | |
| 18072 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18073 | { |
| 18074 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18075 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18076 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18077 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18078 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18079 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18080 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18081 | HDA_AMP_MUTE, bits); |
| 18082 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18083 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18084 | } |
| 18085 | |
| 18086 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18087 | unsigned int res) |
| 18088 | { |
| 18089 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18090 | alc662_lenovo_101e_all_automute(codec); |
| 18091 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18092 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18093 | } |
| 18094 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18095 | /* unsolicited event for HP jack sensing */ |
| 18096 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18097 | unsigned int res) |
| 18098 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18099 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18100 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18101 | else |
| 18102 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18103 | } |
| 18104 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18105 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18106 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18107 | struct alc_spec *spec = codec->spec; |
| 18108 | |
| 18109 | alc262_hippo1_setup(codec); |
| 18110 | spec->ext_mic.pin = 0x18; |
| 18111 | spec->ext_mic.mux_idx = 0; |
| 18112 | spec->int_mic.pin = 0x19; |
| 18113 | spec->int_mic.mux_idx = 1; |
| 18114 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18115 | } |
| 18116 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18117 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18118 | { |
| 18119 | alc262_hippo_automute(codec); |
| 18120 | alc_mic_automute(codec); |
| 18121 | } |
| 18122 | |
| 18123 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18124 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18125 | struct alc_spec *spec = codec->spec; |
| 18126 | |
| 18127 | spec->autocfg.hp_pins[0] = 0x14; |
| 18128 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18129 | } |
| 18130 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18131 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18132 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18133 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18134 | { |
| 18135 | unsigned int present; |
| 18136 | unsigned char bits; |
| 18137 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18138 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18139 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18140 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18141 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18142 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18143 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18144 | } |
| 18145 | |
| 18146 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18147 | { |
| 18148 | unsigned int present; |
| 18149 | unsigned char bits; |
| 18150 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18151 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18152 | bits = present ? HDA_AMP_MUTE : 0; |
| 18153 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18154 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18155 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18156 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18157 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18158 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18159 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18160 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18161 | } |
| 18162 | |
| 18163 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18164 | { |
| 18165 | unsigned int present; |
| 18166 | unsigned char bits; |
| 18167 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18168 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18169 | bits = present ? HDA_AMP_MUTE : 0; |
| 18170 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18171 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18172 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18173 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18174 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18175 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18176 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18177 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18178 | } |
| 18179 | |
| 18180 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18181 | { |
| 18182 | unsigned int present; |
| 18183 | unsigned char bits; |
| 18184 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18185 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18186 | bits = present ? 0 : PIN_OUT; |
| 18187 | snd_hda_codec_write(codec, 0x14, 0, |
| 18188 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18189 | } |
| 18190 | |
| 18191 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18192 | { |
| 18193 | unsigned int present1, present2; |
| 18194 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18195 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18196 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18197 | |
| 18198 | if (present1 || present2) { |
| 18199 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18200 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18201 | } else { |
| 18202 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18203 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18204 | } |
| 18205 | } |
| 18206 | |
| 18207 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18208 | { |
| 18209 | unsigned int present1, present2; |
| 18210 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18211 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18212 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18213 | |
| 18214 | if (present1 || present2) { |
| 18215 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18216 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18217 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18218 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18219 | } else { |
| 18220 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18221 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18222 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18223 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18224 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18225 | } |
| 18226 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18227 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18228 | { |
| 18229 | unsigned int present1, present2; |
| 18230 | |
| 18231 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18232 | AC_VERB_GET_PIN_SENSE, 0) |
| 18233 | & AC_PINSENSE_PRESENCE; |
| 18234 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18235 | AC_VERB_GET_PIN_SENSE, 0) |
| 18236 | & AC_PINSENSE_PRESENCE; |
| 18237 | |
| 18238 | if (present1 || present2) { |
| 18239 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18240 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18241 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18242 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18243 | } else { |
| 18244 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18245 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18246 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18247 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18248 | } |
| 18249 | } |
| 18250 | |
| 18251 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18252 | { |
| 18253 | unsigned int present1, present2; |
| 18254 | |
| 18255 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18256 | AC_VERB_GET_PIN_SENSE, 0) |
| 18257 | & AC_PINSENSE_PRESENCE; |
| 18258 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18259 | AC_VERB_GET_PIN_SENSE, 0) |
| 18260 | & AC_PINSENSE_PRESENCE; |
| 18261 | |
| 18262 | if (present1 || present2) { |
| 18263 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18264 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18265 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18266 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18267 | } else { |
| 18268 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18269 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18270 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18271 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18272 | } |
| 18273 | } |
| 18274 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18275 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18276 | unsigned int res) |
| 18277 | { |
| 18278 | switch (res >> 26) { |
| 18279 | case ALC880_HP_EVENT: |
| 18280 | alc663_m51va_speaker_automute(codec); |
| 18281 | break; |
| 18282 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18283 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18284 | break; |
| 18285 | } |
| 18286 | } |
| 18287 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18288 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18289 | { |
| 18290 | struct alc_spec *spec = codec->spec; |
| 18291 | spec->ext_mic.pin = 0x18; |
| 18292 | spec->ext_mic.mux_idx = 0; |
| 18293 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18294 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18295 | spec->auto_mic = 1; |
| 18296 | } |
| 18297 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18298 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18299 | { |
| 18300 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18301 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18302 | } |
| 18303 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18304 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18305 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18306 | |
| 18307 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18308 | { |
| 18309 | struct alc_spec *spec = codec->spec; |
| 18310 | spec->ext_mic.pin = 0x18; |
| 18311 | spec->ext_mic.mux_idx = 0; |
| 18312 | spec->int_mic.pin = 0x19; |
| 18313 | spec->int_mic.mux_idx = 1; |
| 18314 | spec->auto_mic = 1; |
| 18315 | } |
| 18316 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18317 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18318 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18319 | /* ***************** Mode2 ******************************/ |
| 18320 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18321 | unsigned int res) |
| 18322 | { |
| 18323 | switch (res >> 26) { |
| 18324 | case ALC880_HP_EVENT: |
| 18325 | alc662_f5z_speaker_automute(codec); |
| 18326 | break; |
| 18327 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18328 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18329 | break; |
| 18330 | } |
| 18331 | } |
| 18332 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18333 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18334 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18335 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18336 | { |
| 18337 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18338 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18339 | } |
| 18340 | /* ***************** Mode3 ******************************/ |
| 18341 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18342 | unsigned int res) |
| 18343 | { |
| 18344 | switch (res >> 26) { |
| 18345 | case ALC880_HP_EVENT: |
| 18346 | alc663_two_hp_m1_speaker_automute(codec); |
| 18347 | break; |
| 18348 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18349 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18350 | break; |
| 18351 | } |
| 18352 | } |
| 18353 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18354 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18355 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18356 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18357 | { |
| 18358 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18359 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18360 | } |
| 18361 | /* ***************** Mode4 ******************************/ |
| 18362 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18363 | unsigned int res) |
| 18364 | { |
| 18365 | switch (res >> 26) { |
| 18366 | case ALC880_HP_EVENT: |
| 18367 | alc663_21jd_two_speaker_automute(codec); |
| 18368 | break; |
| 18369 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18370 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18371 | break; |
| 18372 | } |
| 18373 | } |
| 18374 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18375 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18376 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18377 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18378 | { |
| 18379 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18380 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18381 | } |
| 18382 | /* ***************** Mode5 ******************************/ |
| 18383 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18384 | unsigned int res) |
| 18385 | { |
| 18386 | switch (res >> 26) { |
| 18387 | case ALC880_HP_EVENT: |
| 18388 | alc663_15jd_two_speaker_automute(codec); |
| 18389 | break; |
| 18390 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18391 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18392 | break; |
| 18393 | } |
| 18394 | } |
| 18395 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18396 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18397 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18398 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18399 | { |
| 18400 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18401 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18402 | } |
| 18403 | /* ***************** Mode6 ******************************/ |
| 18404 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18405 | unsigned int res) |
| 18406 | { |
| 18407 | switch (res >> 26) { |
| 18408 | case ALC880_HP_EVENT: |
| 18409 | alc663_two_hp_m2_speaker_automute(codec); |
| 18410 | break; |
| 18411 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18412 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18413 | break; |
| 18414 | } |
| 18415 | } |
| 18416 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18417 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18418 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18419 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18420 | { |
| 18421 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18422 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18423 | } |
| 18424 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18425 | /* ***************** Mode7 ******************************/ |
| 18426 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18427 | unsigned int res) |
| 18428 | { |
| 18429 | switch (res >> 26) { |
| 18430 | case ALC880_HP_EVENT: |
| 18431 | alc663_two_hp_m7_speaker_automute(codec); |
| 18432 | break; |
| 18433 | case ALC880_MIC_EVENT: |
| 18434 | alc_mic_automute(codec); |
| 18435 | break; |
| 18436 | } |
| 18437 | } |
| 18438 | |
| 18439 | #define alc663_mode7_setup alc663_mode1_setup |
| 18440 | |
| 18441 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18442 | { |
| 18443 | alc663_two_hp_m7_speaker_automute(codec); |
| 18444 | alc_mic_automute(codec); |
| 18445 | } |
| 18446 | |
| 18447 | /* ***************** Mode8 ******************************/ |
| 18448 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18449 | unsigned int res) |
| 18450 | { |
| 18451 | switch (res >> 26) { |
| 18452 | case ALC880_HP_EVENT: |
| 18453 | alc663_two_hp_m8_speaker_automute(codec); |
| 18454 | break; |
| 18455 | case ALC880_MIC_EVENT: |
| 18456 | alc_mic_automute(codec); |
| 18457 | break; |
| 18458 | } |
| 18459 | } |
| 18460 | |
| 18461 | #define alc663_mode8_setup alc663_m51va_setup |
| 18462 | |
| 18463 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18464 | { |
| 18465 | alc663_two_hp_m8_speaker_automute(codec); |
| 18466 | alc_mic_automute(codec); |
| 18467 | } |
| 18468 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18469 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18470 | { |
| 18471 | unsigned int present; |
| 18472 | unsigned char bits; |
| 18473 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18474 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18475 | bits = present ? HDA_AMP_MUTE : 0; |
| 18476 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18477 | HDA_AMP_MUTE, bits); |
| 18478 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18479 | HDA_AMP_MUTE, bits); |
| 18480 | } |
| 18481 | |
| 18482 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18483 | { |
| 18484 | unsigned int present; |
| 18485 | unsigned char bits; |
| 18486 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18487 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18488 | bits = present ? HDA_AMP_MUTE : 0; |
| 18489 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18490 | HDA_AMP_MUTE, bits); |
| 18491 | } |
| 18492 | |
| 18493 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18494 | unsigned int res) |
| 18495 | { |
| 18496 | switch (res >> 26) { |
| 18497 | case ALC880_HP_EVENT: |
| 18498 | alc663_g71v_hp_automute(codec); |
| 18499 | break; |
| 18500 | case ALC880_FRONT_EVENT: |
| 18501 | alc663_g71v_front_automute(codec); |
| 18502 | break; |
| 18503 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18504 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18505 | break; |
| 18506 | } |
| 18507 | } |
| 18508 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18509 | #define alc663_g71v_setup alc663_m51va_setup |
| 18510 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18511 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18512 | { |
| 18513 | alc663_g71v_front_automute(codec); |
| 18514 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18515 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18516 | } |
| 18517 | |
| 18518 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18519 | unsigned int res) |
| 18520 | { |
| 18521 | switch (res >> 26) { |
| 18522 | case ALC880_HP_EVENT: |
| 18523 | alc663_m51va_speaker_automute(codec); |
| 18524 | break; |
| 18525 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18526 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18527 | break; |
| 18528 | } |
| 18529 | } |
| 18530 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18531 | #define alc663_g50v_setup alc663_m51va_setup |
| 18532 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18533 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18534 | { |
| 18535 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18536 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18537 | } |
| 18538 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18539 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18540 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18541 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18542 | |
| 18543 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18544 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18545 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18546 | |
| 18547 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18548 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18549 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18550 | { } /* end */ |
| 18551 | }; |
| 18552 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18553 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18554 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18555 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18556 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18557 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18558 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18559 | |
| 18560 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18561 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18562 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18563 | |
| 18564 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18565 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18566 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18567 | { } /* end */ |
| 18568 | }; |
| 18569 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18570 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18571 | #define alc662_loopbacks alc880_loopbacks |
| 18572 | #endif |
| 18573 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18574 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18575 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18576 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18577 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18578 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18579 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18580 | |
| 18581 | /* |
| 18582 | * configuration and preset |
| 18583 | */ |
| 18584 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18585 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18586 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18587 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18588 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18589 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18590 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18591 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18592 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18593 | [ALC663_ASUS_M51VA] = "m51va", |
| 18594 | [ALC663_ASUS_G71V] = "g71v", |
| 18595 | [ALC663_ASUS_H13] = "h13", |
| 18596 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18597 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18598 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18599 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18600 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18601 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18602 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18603 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18604 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18605 | [ALC272_DELL] = "dell", |
| 18606 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18607 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18608 | [ALC662_AUTO] = "auto", |
| 18609 | }; |
| 18610 | |
| 18611 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18612 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18613 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18614 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18615 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18616 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18617 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18618 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18619 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18620 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18621 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18622 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18623 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18624 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18625 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18626 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18627 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18628 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18629 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18630 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18631 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18632 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18633 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18634 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18635 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18636 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18637 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18638 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18639 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18640 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18641 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18642 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18643 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18644 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18645 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18646 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18647 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18648 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18649 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18650 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18651 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18652 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18653 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18654 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18655 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18656 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18657 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18658 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18659 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18660 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18661 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18662 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18663 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18664 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18665 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18666 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18667 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18668 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18669 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18670 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18671 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18672 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18673 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18674 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18675 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18676 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18677 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18678 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18679 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18680 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18681 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18682 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18683 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18684 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18685 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18686 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18687 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18688 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18689 | {} |
| 18690 | }; |
| 18691 | |
| 18692 | static struct alc_config_preset alc662_presets[] = { |
| 18693 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18694 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18695 | .init_verbs = { alc662_init_verbs }, |
| 18696 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18697 | .dac_nids = alc662_dac_nids, |
| 18698 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18699 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18700 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18701 | .channel_mode = alc662_3ST_2ch_modes, |
| 18702 | .input_mux = &alc662_capture_source, |
| 18703 | }, |
| 18704 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18705 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18706 | .init_verbs = { alc662_init_verbs }, |
| 18707 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18708 | .dac_nids = alc662_dac_nids, |
| 18709 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18710 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18711 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18712 | .channel_mode = alc662_3ST_6ch_modes, |
| 18713 | .need_dac_fix = 1, |
| 18714 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18715 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18716 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18717 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18718 | .init_verbs = { alc662_init_verbs }, |
| 18719 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18720 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18721 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18722 | .channel_mode = alc662_3ST_6ch_modes, |
| 18723 | .need_dac_fix = 1, |
| 18724 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18725 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18726 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18727 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18728 | .init_verbs = { alc662_init_verbs }, |
| 18729 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18730 | .dac_nids = alc662_dac_nids, |
| 18731 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18732 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18733 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18734 | .channel_mode = alc662_5stack_modes, |
| 18735 | .input_mux = &alc662_capture_source, |
| 18736 | }, |
| 18737 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18738 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18739 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18740 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18741 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18742 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18743 | .channel_mode = alc662_3ST_2ch_modes, |
| 18744 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18745 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18746 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18747 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18748 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18749 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18750 | .init_verbs = { alc662_init_verbs, |
| 18751 | alc662_eeepc_sue_init_verbs }, |
| 18752 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18753 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18754 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18755 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18756 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18757 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18758 | .init_hook = alc662_eeepc_inithook, |
| 18759 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18760 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18761 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18762 | alc662_chmode_mixer }, |
| 18763 | .init_verbs = { alc662_init_verbs, |
| 18764 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18765 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18766 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18767 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18768 | .channel_mode = alc662_3ST_6ch_modes, |
| 18769 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18770 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18771 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18772 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18773 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18774 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18775 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18776 | .init_verbs = { alc662_init_verbs, |
| 18777 | alc662_ecs_init_verbs }, |
| 18778 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18779 | .dac_nids = alc662_dac_nids, |
| 18780 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18781 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18782 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18783 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18784 | .init_hook = alc662_eeepc_inithook, |
| 18785 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18786 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18787 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18788 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18789 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18790 | .dac_nids = alc662_dac_nids, |
| 18791 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18792 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18793 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18794 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18795 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18796 | .init_hook = alc663_m51va_inithook, |
| 18797 | }, |
| 18798 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18799 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18800 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18801 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18802 | .dac_nids = alc662_dac_nids, |
| 18803 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18804 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18805 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18806 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18807 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18808 | .init_hook = alc663_g71v_inithook, |
| 18809 | }, |
| 18810 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18811 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18812 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18813 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18814 | .dac_nids = alc662_dac_nids, |
| 18815 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18816 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18817 | .unsol_event = alc663_m51va_unsol_event, |
| 18818 | .init_hook = alc663_m51va_inithook, |
| 18819 | }, |
| 18820 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18821 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18822 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18823 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18824 | .dac_nids = alc662_dac_nids, |
| 18825 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18826 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18827 | .channel_mode = alc662_3ST_6ch_modes, |
| 18828 | .input_mux = &alc663_capture_source, |
| 18829 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18830 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18831 | .init_hook = alc663_g50v_inithook, |
| 18832 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18833 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18834 | .mixers = { alc663_m51va_mixer }, |
| 18835 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18836 | .init_verbs = { alc662_init_verbs, |
| 18837 | alc663_21jd_amic_init_verbs }, |
| 18838 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18839 | .hp_nid = 0x03, |
| 18840 | .dac_nids = alc662_dac_nids, |
| 18841 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18842 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18843 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18844 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18845 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18846 | .init_hook = alc663_mode1_inithook, |
| 18847 | }, |
| 18848 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18849 | .mixers = { alc662_1bjd_mixer }, |
| 18850 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18851 | .init_verbs = { alc662_init_verbs, |
| 18852 | alc662_1bjd_amic_init_verbs }, |
| 18853 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18854 | .dac_nids = alc662_dac_nids, |
| 18855 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18856 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18857 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18858 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18859 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18860 | .init_hook = alc662_mode2_inithook, |
| 18861 | }, |
| 18862 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18863 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18864 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18865 | .init_verbs = { alc662_init_verbs, |
| 18866 | alc663_two_hp_amic_m1_init_verbs }, |
| 18867 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18868 | .hp_nid = 0x03, |
| 18869 | .dac_nids = alc662_dac_nids, |
| 18870 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18871 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18872 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18873 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18874 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18875 | .init_hook = alc663_mode3_inithook, |
| 18876 | }, |
| 18877 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18878 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18879 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18880 | .init_verbs = { alc662_init_verbs, |
| 18881 | alc663_21jd_amic_init_verbs}, |
| 18882 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18883 | .hp_nid = 0x03, |
| 18884 | .dac_nids = alc662_dac_nids, |
| 18885 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18886 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18887 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18888 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18889 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18890 | .init_hook = alc663_mode4_inithook, |
| 18891 | }, |
| 18892 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18893 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18894 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18895 | .init_verbs = { alc662_init_verbs, |
| 18896 | alc663_15jd_amic_init_verbs }, |
| 18897 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18898 | .hp_nid = 0x03, |
| 18899 | .dac_nids = alc662_dac_nids, |
| 18900 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18901 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18902 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18903 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18904 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18905 | .init_hook = alc663_mode5_inithook, |
| 18906 | }, |
| 18907 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18908 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18909 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18910 | .init_verbs = { alc662_init_verbs, |
| 18911 | alc663_two_hp_amic_m2_init_verbs }, |
| 18912 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18913 | .hp_nid = 0x03, |
| 18914 | .dac_nids = alc662_dac_nids, |
| 18915 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18916 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18917 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18918 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18919 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18920 | .init_hook = alc663_mode6_inithook, |
| 18921 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18922 | [ALC663_ASUS_MODE7] = { |
| 18923 | .mixers = { alc663_mode7_mixer }, |
| 18924 | .cap_mixer = alc662_auto_capture_mixer, |
| 18925 | .init_verbs = { alc662_init_verbs, |
| 18926 | alc663_mode7_init_verbs }, |
| 18927 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18928 | .hp_nid = 0x03, |
| 18929 | .dac_nids = alc662_dac_nids, |
| 18930 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18931 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18932 | .channel_mode = alc662_3ST_2ch_modes, |
| 18933 | .unsol_event = alc663_mode7_unsol_event, |
| 18934 | .setup = alc663_mode7_setup, |
| 18935 | .init_hook = alc663_mode7_inithook, |
| 18936 | }, |
| 18937 | [ALC663_ASUS_MODE8] = { |
| 18938 | .mixers = { alc663_mode8_mixer }, |
| 18939 | .cap_mixer = alc662_auto_capture_mixer, |
| 18940 | .init_verbs = { alc662_init_verbs, |
| 18941 | alc663_mode8_init_verbs }, |
| 18942 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18943 | .hp_nid = 0x03, |
| 18944 | .dac_nids = alc662_dac_nids, |
| 18945 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18946 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18947 | .channel_mode = alc662_3ST_2ch_modes, |
| 18948 | .unsol_event = alc663_mode8_unsol_event, |
| 18949 | .setup = alc663_mode8_setup, |
| 18950 | .init_hook = alc663_mode8_inithook, |
| 18951 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18952 | [ALC272_DELL] = { |
| 18953 | .mixers = { alc663_m51va_mixer }, |
| 18954 | .cap_mixer = alc272_auto_capture_mixer, |
| 18955 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18956 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18957 | .dac_nids = alc662_dac_nids, |
| 18958 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18959 | .adc_nids = alc272_adc_nids, |
| 18960 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18961 | .capsrc_nids = alc272_capsrc_nids, |
| 18962 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18963 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18964 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18965 | .init_hook = alc663_m51va_inithook, |
| 18966 | }, |
| 18967 | [ALC272_DELL_ZM1] = { |
| 18968 | .mixers = { alc663_m51va_mixer }, |
| 18969 | .cap_mixer = alc662_auto_capture_mixer, |
| 18970 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18971 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18972 | .dac_nids = alc662_dac_nids, |
| 18973 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18974 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18975 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18976 | .capsrc_nids = alc662_capsrc_nids, |
| 18977 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18978 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18979 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18980 | .init_hook = alc663_m51va_inithook, |
| 18981 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18982 | [ALC272_SAMSUNG_NC10] = { |
| 18983 | .mixers = { alc272_nc10_mixer }, |
| 18984 | .init_verbs = { alc662_init_verbs, |
| 18985 | alc663_21jd_amic_init_verbs }, |
| 18986 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18987 | .dac_nids = alc272_dac_nids, |
| 18988 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18989 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18990 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18991 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18992 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18993 | .init_hook = alc663_mode4_inithook, |
| 18994 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18995 | }; |
| 18996 | |
| 18997 | |
| 18998 | /* |
| 18999 | * BIOS auto configuration |
| 19000 | */ |
| 19001 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19002 | /* convert from MIX nid to DAC */ |
| 19003 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 19004 | { |
| 19005 | if (nid == 0x0f) |
| 19006 | return 0x02; |
| 19007 | else if (nid >= 0x0c && nid <= 0x0e) |
| 19008 | return nid - 0x0c + 0x02; |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19009 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
| 19010 | return 0x25; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19011 | else |
| 19012 | return 0; |
| 19013 | } |
| 19014 | |
| 19015 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 19016 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 19017 | hda_nid_t dac) |
| 19018 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19019 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19020 | int i, num; |
| 19021 | |
| 19022 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 19023 | for (i = 0; i < num; i++) { |
| 19024 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 19025 | return mix[i]; |
| 19026 | } |
| 19027 | return 0; |
| 19028 | } |
| 19029 | |
| 19030 | /* look for an empty DAC slot */ |
| 19031 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 19032 | { |
| 19033 | struct alc_spec *spec = codec->spec; |
| 19034 | hda_nid_t srcs[5]; |
| 19035 | int i, j, num; |
| 19036 | |
| 19037 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 19038 | if (num < 0) |
| 19039 | return 0; |
| 19040 | for (i = 0; i < num; i++) { |
| 19041 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 19042 | if (!nid) |
| 19043 | continue; |
| 19044 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19045 | if (spec->multiout.dac_nids[j] == nid) |
| 19046 | break; |
| 19047 | if (j >= spec->multiout.num_dacs) |
| 19048 | return nid; |
| 19049 | } |
| 19050 | return 0; |
| 19051 | } |
| 19052 | |
| 19053 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19054 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19055 | const struct auto_pin_cfg *cfg) |
| 19056 | { |
| 19057 | struct alc_spec *spec = codec->spec; |
| 19058 | int i; |
| 19059 | hda_nid_t dac; |
| 19060 | |
| 19061 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19062 | for (i = 0; i < cfg->line_outs; i++) { |
| 19063 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19064 | if (!dac) |
| 19065 | continue; |
| 19066 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19067 | } |
| 19068 | return 0; |
| 19069 | } |
| 19070 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19071 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19072 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19073 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19074 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19075 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19076 | } |
| 19077 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19078 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19079 | hda_nid_t nid, unsigned int chs) |
| 19080 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19081 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19082 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19083 | } |
| 19084 | |
| 19085 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19086 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19087 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19088 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19089 | |
| 19090 | /* add playback controls from the parsed DAC table */ |
| 19091 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19092 | const struct auto_pin_cfg *cfg) |
| 19093 | { |
| 19094 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19095 | static const char *chname[4] = { |
| 19096 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19097 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19098 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19099 | int i, err; |
| 19100 | |
| 19101 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19102 | nid = spec->multiout.dac_nids[i]; |
| 19103 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19104 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19105 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19106 | if (!mix) |
| 19107 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19108 | if (i == 2) { |
| 19109 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19110 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19111 | if (err < 0) |
| 19112 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19113 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19114 | if (err < 0) |
| 19115 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19116 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19117 | if (err < 0) |
| 19118 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19119 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19120 | if (err < 0) |
| 19121 | return err; |
| 19122 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19123 | const char *pfx; |
| 19124 | if (cfg->line_outs == 1 && |
| 19125 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19126 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19127 | pfx = "Speaker"; |
| 19128 | else |
| 19129 | pfx = "PCM"; |
| 19130 | } else |
| 19131 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19132 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19133 | if (err < 0) |
| 19134 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19135 | if (cfg->line_outs == 1 && |
| 19136 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19137 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19138 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19139 | if (err < 0) |
| 19140 | return err; |
| 19141 | } |
| 19142 | } |
| 19143 | return 0; |
| 19144 | } |
| 19145 | |
| 19146 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19147 | /* return DAC nid if any new DAC is assigned */ |
| 19148 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19149 | const char *pfx) |
| 19150 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19151 | struct alc_spec *spec = codec->spec; |
| 19152 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19153 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19154 | |
| 19155 | if (!pin) |
| 19156 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19157 | nid = alc662_look_for_dac(codec, pin); |
| 19158 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19159 | /* the corresponding DAC is already occupied */ |
| 19160 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19161 | return 0; /* no way */ |
| 19162 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19163 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19164 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19165 | } |
| 19166 | |
| 19167 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19168 | if (!mix) |
| 19169 | return 0; |
| 19170 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19171 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19172 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19173 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19174 | if (err < 0) |
| 19175 | return err; |
| 19176 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19177 | } |
| 19178 | |
| 19179 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19180 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19181 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19182 | |
| 19183 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19184 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19185 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19186 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19187 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19188 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19189 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19190 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19191 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19192 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19193 | if (num <= 1) |
| 19194 | return; |
| 19195 | for (i = 0; i < num; i++) { |
| 19196 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19197 | continue; |
| 19198 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19199 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19200 | } |
| 19201 | } |
| 19202 | |
| 19203 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19204 | { |
| 19205 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19206 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19207 | int i; |
| 19208 | |
| 19209 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19210 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19211 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19212 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19213 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19214 | } |
| 19215 | } |
| 19216 | |
| 19217 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19218 | { |
| 19219 | struct alc_spec *spec = codec->spec; |
| 19220 | hda_nid_t pin; |
| 19221 | |
| 19222 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19223 | if (pin) |
| 19224 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19225 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19226 | pin = spec->autocfg.speaker_pins[0]; |
| 19227 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19228 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19229 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19230 | } |
| 19231 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19232 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19233 | |
| 19234 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19235 | { |
| 19236 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19237 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19238 | int i; |
| 19239 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19240 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19241 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19242 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19243 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19244 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19245 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19246 | snd_hda_codec_write(codec, nid, 0, |
| 19247 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19248 | AMP_OUT_MUTE); |
| 19249 | } |
| 19250 | } |
| 19251 | } |
| 19252 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19253 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19254 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19255 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19256 | { |
| 19257 | struct alc_spec *spec = codec->spec; |
| 19258 | int err; |
| 19259 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19260 | |
| 19261 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19262 | alc662_ignore); |
| 19263 | if (err < 0) |
| 19264 | return err; |
| 19265 | if (!spec->autocfg.line_outs) |
| 19266 | return 0; /* can't find valid BIOS pin config */ |
| 19267 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19268 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19269 | if (err < 0) |
| 19270 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19271 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19272 | if (err < 0) |
| 19273 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19274 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19275 | spec->autocfg.speaker_pins[0], |
| 19276 | "Speaker"); |
| 19277 | if (err < 0) |
| 19278 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19279 | if (err) |
| 19280 | spec->multiout.extra_out_nid[0] = err; |
| 19281 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19282 | "Headphone"); |
| 19283 | if (err < 0) |
| 19284 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19285 | if (err) |
| 19286 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19287 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19288 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19289 | return err; |
| 19290 | |
| 19291 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19292 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19293 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19294 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19295 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19296 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19297 | |
| 19298 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19299 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19300 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19301 | add_verb(spec, alc662_init_verbs); |
| 19302 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19303 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19304 | add_verb(spec, alc663_init_verbs); |
| 19305 | |
| 19306 | if (codec->vendor_id == 0x10ec0272) |
| 19307 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19308 | |
| 19309 | err = alc_auto_add_mic_boost(codec); |
| 19310 | if (err < 0) |
| 19311 | return err; |
| 19312 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19313 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19314 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19315 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19316 | else |
| 19317 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19318 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19319 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19320 | } |
| 19321 | |
| 19322 | /* additional initialization for auto-configuration model */ |
| 19323 | static void alc662_auto_init(struct hda_codec *codec) |
| 19324 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19325 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19326 | alc662_auto_init_multi_out(codec); |
| 19327 | alc662_auto_init_hp_out(codec); |
| 19328 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19329 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19330 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19331 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19332 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19333 | } |
| 19334 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19335 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19336 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19337 | ALC662_FIXUP_IDEAPAD, |
| 19338 | }; |
| 19339 | |
| 19340 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19341 | [ALC662_FIXUP_ASPIRE] = { |
| 19342 | .pins = (const struct alc_pincfg[]) { |
| 19343 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19344 | { } |
| 19345 | } |
| 19346 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19347 | [ALC662_FIXUP_IDEAPAD] = { |
| 19348 | .pins = (const struct alc_pincfg[]) { |
| 19349 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19350 | { } |
| 19351 | } |
| 19352 | }, |
| 19353 | }; |
| 19354 | |
| 19355 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19356 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19357 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19358 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19359 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19360 | {} |
| 19361 | }; |
| 19362 | |
| 19363 | |
| 19364 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19365 | static int patch_alc662(struct hda_codec *codec) |
| 19366 | { |
| 19367 | struct alc_spec *spec; |
| 19368 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19369 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19370 | |
| 19371 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19372 | if (!spec) |
| 19373 | return -ENOMEM; |
| 19374 | |
| 19375 | codec->spec = spec; |
| 19376 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19377 | alc_auto_parse_customize_define(codec); |
| 19378 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19379 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19380 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19381 | coef = alc_read_coef_idx(codec, 0); |
| 19382 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19383 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19384 | else if (coef & (1 << 14) && |
| 19385 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19386 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19387 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19388 | else if (coef == 0x4011) |
| 19389 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19390 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19391 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19392 | alc662_models, |
| 19393 | alc662_cfg_tbl); |
| 19394 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19395 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19396 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19397 | board_config = ALC662_AUTO; |
| 19398 | } |
| 19399 | |
| 19400 | if (board_config == ALC662_AUTO) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19401 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19402 | /* automatic parse from the BIOS config */ |
| 19403 | err = alc662_parse_auto_config(codec); |
| 19404 | if (err < 0) { |
| 19405 | alc_free(codec); |
| 19406 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19407 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19408 | printk(KERN_INFO |
| 19409 | "hda_codec: Cannot set up configuration " |
| 19410 | "from BIOS. Using base mode...\n"); |
| 19411 | board_config = ALC662_3ST_2ch_DIG; |
| 19412 | } |
| 19413 | } |
| 19414 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19415 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19416 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19417 | if (err < 0) { |
| 19418 | alc_free(codec); |
| 19419 | return err; |
| 19420 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19421 | } |
| 19422 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19423 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19424 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19425 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19426 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19427 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19428 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19429 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19430 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19431 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19432 | if (!spec->adc_nids) { |
| 19433 | spec->adc_nids = alc662_adc_nids; |
| 19434 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19435 | } |
| 19436 | if (!spec->capsrc_nids) |
| 19437 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19438 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19439 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19440 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19441 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19442 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19443 | switch (codec->vendor_id) { |
| 19444 | case 0x10ec0662: |
| 19445 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19446 | break; |
| 19447 | case 0x10ec0272: |
| 19448 | case 0x10ec0663: |
| 19449 | case 0x10ec0665: |
| 19450 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19451 | break; |
| 19452 | case 0x10ec0273: |
| 19453 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19454 | break; |
| 19455 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19456 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19457 | spec->vmaster_nid = 0x02; |
| 19458 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19459 | codec->patch_ops = alc_patch_ops; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19460 | if (board_config == ALC662_AUTO) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19461 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19462 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
| 19463 | } |
| 19464 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19465 | alc_init_jacks(codec); |
| 19466 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19467 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19468 | if (!spec->loopback.amplist) |
| 19469 | spec->loopback.amplist = alc662_loopbacks; |
| 19470 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19471 | |
| 19472 | return 0; |
| 19473 | } |
| 19474 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19475 | static int patch_alc888(struct hda_codec *codec) |
| 19476 | { |
| 19477 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19478 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19479 | if (codec->vendor_id == 0x10ec0887) |
| 19480 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19481 | else |
| 19482 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19483 | if (!codec->chip_name) { |
| 19484 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19485 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19486 | } |
| 19487 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19488 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19489 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19490 | } |
| 19491 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19492 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19493 | * ALC680 support |
| 19494 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19495 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19496 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19497 | #define alc680_modes alc260_modes |
| 19498 | |
| 19499 | static hda_nid_t alc680_dac_nids[3] = { |
| 19500 | /* Lout1, Lout2, hp */ |
| 19501 | 0x02, 0x03, 0x04 |
| 19502 | }; |
| 19503 | |
| 19504 | static hda_nid_t alc680_adc_nids[3] = { |
| 19505 | /* ADC0-2 */ |
| 19506 | /* DMIC, MIC, Line-in*/ |
| 19507 | 0x07, 0x08, 0x09 |
| 19508 | }; |
| 19509 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19510 | /* |
| 19511 | * Analog capture ADC cgange |
| 19512 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19513 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19514 | { |
| 19515 | struct alc_spec *spec = codec->spec; |
| 19516 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19517 | int pin_found = 0; |
| 19518 | int type_found = AUTO_PIN_LAST; |
| 19519 | hda_nid_t nid; |
| 19520 | int i; |
| 19521 | |
| 19522 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19523 | nid = cfg->inputs[i].pin; |
| 19524 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19525 | AC_PINCAP_PRES_DETECT)) |
| 19526 | continue; |
| 19527 | if (snd_hda_jack_detect(codec, nid)) { |
| 19528 | if (cfg->inputs[i].type < type_found) { |
| 19529 | type_found = cfg->inputs[i].type; |
| 19530 | pin_found = nid; |
| 19531 | } |
| 19532 | } |
| 19533 | } |
| 19534 | |
| 19535 | nid = 0x07; |
| 19536 | if (pin_found) |
| 19537 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19538 | |
| 19539 | if (nid != spec->cur_adc) |
| 19540 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19541 | spec->cur_adc = nid; |
| 19542 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19543 | spec->cur_adc_format); |
| 19544 | } |
| 19545 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19546 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19547 | struct hda_codec *codec, |
| 19548 | unsigned int stream_tag, |
| 19549 | unsigned int format, |
| 19550 | struct snd_pcm_substream *substream) |
| 19551 | { |
| 19552 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19553 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19554 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19555 | spec->cur_adc_stream_tag = stream_tag; |
| 19556 | spec->cur_adc_format = format; |
| 19557 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19558 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19559 | return 0; |
| 19560 | } |
| 19561 | |
| 19562 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19563 | struct hda_codec *codec, |
| 19564 | struct snd_pcm_substream *substream) |
| 19565 | { |
| 19566 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19567 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19568 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19569 | return 0; |
| 19570 | } |
| 19571 | |
| 19572 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19573 | .substreams = 1, /* can be overridden */ |
| 19574 | .channels_min = 2, |
| 19575 | .channels_max = 2, |
| 19576 | /* NID is set in alc_build_pcms */ |
| 19577 | .ops = { |
| 19578 | .prepare = alc680_capture_pcm_prepare, |
| 19579 | .cleanup = alc680_capture_pcm_cleanup |
| 19580 | }, |
| 19581 | }; |
| 19582 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19583 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19584 | /* output mixer control */ |
| 19585 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19586 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19587 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19588 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19589 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19590 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19591 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19592 | { } |
| 19593 | }; |
| 19594 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19595 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19596 | .ops = &snd_hda_bind_vol, |
| 19597 | .values = { |
| 19598 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19599 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19600 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19601 | 0 |
| 19602 | }, |
| 19603 | }; |
| 19604 | |
| 19605 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19606 | .ops = &snd_hda_bind_sw, |
| 19607 | .values = { |
| 19608 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19609 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19610 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19611 | 0 |
| 19612 | }, |
| 19613 | }; |
| 19614 | |
| 19615 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19616 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19617 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19618 | { } /* end */ |
| 19619 | }; |
| 19620 | |
| 19621 | /* |
| 19622 | * generic initialization of ADC, input mixers and output mixers |
| 19623 | */ |
| 19624 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19625 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19626 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19627 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19628 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19629 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19630 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19631 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19632 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19633 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19634 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19635 | |
| 19636 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19637 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19638 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19639 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19640 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19641 | |
| 19642 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19643 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19644 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19645 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19646 | { } |
| 19647 | }; |
| 19648 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19649 | /* toggle speaker-output according to the hp-jack state */ |
| 19650 | static void alc680_base_setup(struct hda_codec *codec) |
| 19651 | { |
| 19652 | struct alc_spec *spec = codec->spec; |
| 19653 | |
| 19654 | spec->autocfg.hp_pins[0] = 0x16; |
| 19655 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19656 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19657 | spec->autocfg.num_inputs = 2; |
| 19658 | spec->autocfg.inputs[0].pin = 0x18; |
| 19659 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19660 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19661 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19662 | } |
| 19663 | |
| 19664 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19665 | unsigned int res) |
| 19666 | { |
| 19667 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19668 | alc_automute_amp(codec); |
| 19669 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19670 | alc680_rec_autoswitch(codec); |
| 19671 | } |
| 19672 | |
| 19673 | static void alc680_inithook(struct hda_codec *codec) |
| 19674 | { |
| 19675 | alc_automute_amp(codec); |
| 19676 | alc680_rec_autoswitch(codec); |
| 19677 | } |
| 19678 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19679 | /* create input playback/capture controls for the given pin */ |
| 19680 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19681 | const char *ctlname, int idx) |
| 19682 | { |
| 19683 | hda_nid_t dac; |
| 19684 | int err; |
| 19685 | |
| 19686 | switch (nid) { |
| 19687 | case 0x14: |
| 19688 | dac = 0x02; |
| 19689 | break; |
| 19690 | case 0x15: |
| 19691 | dac = 0x03; |
| 19692 | break; |
| 19693 | case 0x16: |
| 19694 | dac = 0x04; |
| 19695 | break; |
| 19696 | default: |
| 19697 | return 0; |
| 19698 | } |
| 19699 | if (spec->multiout.dac_nids[0] != dac && |
| 19700 | spec->multiout.dac_nids[1] != dac) { |
| 19701 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19702 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19703 | HDA_OUTPUT)); |
| 19704 | if (err < 0) |
| 19705 | return err; |
| 19706 | |
| 19707 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19708 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19709 | |
| 19710 | if (err < 0) |
| 19711 | return err; |
| 19712 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19713 | } |
| 19714 | |
| 19715 | return 0; |
| 19716 | } |
| 19717 | |
| 19718 | /* add playback controls from the parsed DAC table */ |
| 19719 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19720 | const struct auto_pin_cfg *cfg) |
| 19721 | { |
| 19722 | hda_nid_t nid; |
| 19723 | int err; |
| 19724 | |
| 19725 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19726 | |
| 19727 | nid = cfg->line_out_pins[0]; |
| 19728 | if (nid) { |
| 19729 | const char *name; |
| 19730 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19731 | name = "Speaker"; |
| 19732 | else |
| 19733 | name = "Front"; |
| 19734 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19735 | if (err < 0) |
| 19736 | return err; |
| 19737 | } |
| 19738 | |
| 19739 | nid = cfg->speaker_pins[0]; |
| 19740 | if (nid) { |
| 19741 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19742 | if (err < 0) |
| 19743 | return err; |
| 19744 | } |
| 19745 | nid = cfg->hp_pins[0]; |
| 19746 | if (nid) { |
| 19747 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19748 | if (err < 0) |
| 19749 | return err; |
| 19750 | } |
| 19751 | |
| 19752 | return 0; |
| 19753 | } |
| 19754 | |
| 19755 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19756 | hda_nid_t nid, int pin_type) |
| 19757 | { |
| 19758 | alc_set_pin_output(codec, nid, pin_type); |
| 19759 | } |
| 19760 | |
| 19761 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19762 | { |
| 19763 | struct alc_spec *spec = codec->spec; |
| 19764 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19765 | if (nid) { |
| 19766 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19767 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19768 | } |
| 19769 | } |
| 19770 | |
| 19771 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19772 | { |
| 19773 | struct alc_spec *spec = codec->spec; |
| 19774 | hda_nid_t pin; |
| 19775 | |
| 19776 | pin = spec->autocfg.hp_pins[0]; |
| 19777 | if (pin) |
| 19778 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19779 | pin = spec->autocfg.speaker_pins[0]; |
| 19780 | if (pin) |
| 19781 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19782 | } |
| 19783 | |
| 19784 | /* pcm configuration: identical with ALC880 */ |
| 19785 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19786 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19787 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19788 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19789 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19790 | |
| 19791 | /* |
| 19792 | * BIOS auto configuration |
| 19793 | */ |
| 19794 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19795 | { |
| 19796 | struct alc_spec *spec = codec->spec; |
| 19797 | int err; |
| 19798 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19799 | |
| 19800 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19801 | alc680_ignore); |
| 19802 | if (err < 0) |
| 19803 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19804 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19805 | if (!spec->autocfg.line_outs) { |
| 19806 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19807 | spec->multiout.max_channels = 2; |
| 19808 | spec->no_analog = 1; |
| 19809 | goto dig_only; |
| 19810 | } |
| 19811 | return 0; /* can't find valid BIOS pin config */ |
| 19812 | } |
| 19813 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19814 | if (err < 0) |
| 19815 | return err; |
| 19816 | |
| 19817 | spec->multiout.max_channels = 2; |
| 19818 | |
| 19819 | dig_only: |
| 19820 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19821 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19822 | if (spec->kctls.list) |
| 19823 | add_mixer(spec, spec->kctls.list); |
| 19824 | |
| 19825 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19826 | |
| 19827 | err = alc_auto_add_mic_boost(codec); |
| 19828 | if (err < 0) |
| 19829 | return err; |
| 19830 | |
| 19831 | return 1; |
| 19832 | } |
| 19833 | |
| 19834 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19835 | |
| 19836 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19837 | static void alc680_auto_init(struct hda_codec *codec) |
| 19838 | { |
| 19839 | struct alc_spec *spec = codec->spec; |
| 19840 | alc680_auto_init_multi_out(codec); |
| 19841 | alc680_auto_init_hp_out(codec); |
| 19842 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19843 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19844 | if (spec->unsol_event) |
| 19845 | alc_inithook(codec); |
| 19846 | } |
| 19847 | |
| 19848 | /* |
| 19849 | * configuration and preset |
| 19850 | */ |
| 19851 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19852 | [ALC680_BASE] = "base", |
| 19853 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19854 | }; |
| 19855 | |
| 19856 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19857 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19858 | {} |
| 19859 | }; |
| 19860 | |
| 19861 | static struct alc_config_preset alc680_presets[] = { |
| 19862 | [ALC680_BASE] = { |
| 19863 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19864 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19865 | .init_verbs = { alc680_init_verbs }, |
| 19866 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19867 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19868 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19869 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19870 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19871 | .unsol_event = alc680_unsol_event, |
| 19872 | .setup = alc680_base_setup, |
| 19873 | .init_hook = alc680_inithook, |
| 19874 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19875 | }, |
| 19876 | }; |
| 19877 | |
| 19878 | static int patch_alc680(struct hda_codec *codec) |
| 19879 | { |
| 19880 | struct alc_spec *spec; |
| 19881 | int board_config; |
| 19882 | int err; |
| 19883 | |
| 19884 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19885 | if (spec == NULL) |
| 19886 | return -ENOMEM; |
| 19887 | |
| 19888 | codec->spec = spec; |
| 19889 | |
| 19890 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19891 | alc680_models, |
| 19892 | alc680_cfg_tbl); |
| 19893 | |
| 19894 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19895 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19896 | codec->chip_name); |
| 19897 | board_config = ALC680_AUTO; |
| 19898 | } |
| 19899 | |
| 19900 | if (board_config == ALC680_AUTO) { |
| 19901 | /* automatic parse from the BIOS config */ |
| 19902 | err = alc680_parse_auto_config(codec); |
| 19903 | if (err < 0) { |
| 19904 | alc_free(codec); |
| 19905 | return err; |
| 19906 | } else if (!err) { |
| 19907 | printk(KERN_INFO |
| 19908 | "hda_codec: Cannot set up configuration " |
| 19909 | "from BIOS. Using base mode...\n"); |
| 19910 | board_config = ALC680_BASE; |
| 19911 | } |
| 19912 | } |
| 19913 | |
| 19914 | if (board_config != ALC680_AUTO) |
| 19915 | setup_preset(codec, &alc680_presets[board_config]); |
| 19916 | |
| 19917 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19918 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19919 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19920 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19921 | |
| 19922 | if (!spec->adc_nids) { |
| 19923 | spec->adc_nids = alc680_adc_nids; |
| 19924 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19925 | } |
| 19926 | |
| 19927 | if (!spec->cap_mixer) |
| 19928 | set_capture_mixer(codec); |
| 19929 | |
| 19930 | spec->vmaster_nid = 0x02; |
| 19931 | |
| 19932 | codec->patch_ops = alc_patch_ops; |
| 19933 | if (board_config == ALC680_AUTO) |
| 19934 | spec->init_hook = alc680_auto_init; |
| 19935 | |
| 19936 | return 0; |
| 19937 | } |
| 19938 | |
| 19939 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19940 | * patch entries |
| 19941 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19942 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19943 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19944 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19945 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19946 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19947 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19948 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19949 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19950 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19951 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19952 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19953 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19954 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19955 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19956 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19957 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19958 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19959 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19960 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19961 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19962 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19963 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19964 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19965 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19966 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19967 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19968 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19969 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19970 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19971 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19972 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19973 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19974 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19975 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19976 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19977 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19978 | {} /* terminator */ |
| 19979 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19980 | |
| 19981 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19982 | |
| 19983 | MODULE_LICENSE("GPL"); |
| 19984 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19985 | |
| 19986 | static struct hda_codec_preset_list realtek_list = { |
| 19987 | .preset = snd_hda_preset_realtek, |
| 19988 | .owner = THIS_MODULE, |
| 19989 | }; |
| 19990 | |
| 19991 | static int __init patch_realtek_init(void) |
| 19992 | { |
| 19993 | return snd_hda_add_codec_preset(&realtek_list); |
| 19994 | } |
| 19995 | |
| 19996 | static void __exit patch_realtek_exit(void) |
| 19997 | { |
| 19998 | snd_hda_delete_codec_preset(&realtek_list); |
| 19999 | } |
| 20000 | |
| 20001 | module_init(patch_realtek_init) |
| 20002 | module_exit(patch_realtek_exit) |