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, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 234 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 235 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 236 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 238 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 240 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 241 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 242 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 243 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 244 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 245 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 246 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 247 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 248 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 249 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 250 | ALC889A_INTEL, |
| 251 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 252 | ALC888_ASUS_M90V, |
| 253 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 254 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 255 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 256 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 257 | ALC882_AUTO, |
| 258 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 259 | }; |
| 260 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 261 | /* ALC680 models */ |
| 262 | enum { |
| 263 | ALC680_BASE, |
| 264 | ALC680_AUTO, |
| 265 | ALC680_MODEL_LAST, |
| 266 | }; |
| 267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 268 | /* for GPIO Poll */ |
| 269 | #define GPIO_MASK 0x03 |
| 270 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 271 | /* extra amp-initialization sequence types */ |
| 272 | enum { |
| 273 | ALC_INIT_NONE, |
| 274 | ALC_INIT_DEFAULT, |
| 275 | ALC_INIT_GPIO1, |
| 276 | ALC_INIT_GPIO2, |
| 277 | ALC_INIT_GPIO3, |
| 278 | }; |
| 279 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 280 | struct alc_mic_route { |
| 281 | hda_nid_t pin; |
| 282 | unsigned char mux_idx; |
| 283 | unsigned char amix_idx; |
| 284 | }; |
| 285 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 286 | struct alc_jack { |
| 287 | hda_nid_t nid; |
| 288 | int type; |
| 289 | struct snd_jack *jack; |
| 290 | }; |
| 291 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 292 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 293 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 294 | struct alc_customize_define { |
| 295 | unsigned int sku_cfg; |
| 296 | unsigned char port_connectivity; |
| 297 | unsigned char check_sum; |
| 298 | unsigned char customization; |
| 299 | unsigned char external_amp; |
| 300 | unsigned int enable_pcbeep:1; |
| 301 | unsigned int platform_type:1; |
| 302 | unsigned int swap:1; |
| 303 | unsigned int override:1; |
| 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 | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 396 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 397 | /* for virtual master */ |
| 398 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 399 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 400 | struct hda_loopback_check loopback; |
| 401 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 402 | |
| 403 | /* for PLL fix */ |
| 404 | hda_nid_t pll_nid; |
| 405 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 406 | }; |
| 407 | |
| 408 | /* |
| 409 | * configuration template - to be copied to the spec instance |
| 410 | */ |
| 411 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 412 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 413 | * with spec |
| 414 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 415 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 416 | const struct hda_verb *init_verbs[5]; |
| 417 | unsigned int num_dacs; |
| 418 | hda_nid_t *dac_nids; |
| 419 | hda_nid_t dig_out_nid; /* optional */ |
| 420 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 421 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 422 | unsigned int num_adc_nids; |
| 423 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 424 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 425 | hda_nid_t dig_in_nid; |
| 426 | unsigned int num_channel_mode; |
| 427 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 428 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 429 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 430 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 431 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 432 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 433 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 434 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 435 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 436 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 437 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 438 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | }; |
| 440 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | |
| 442 | /* |
| 443 | * input MUX handling |
| 444 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 445 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 446 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | { |
| 448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 449 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 450 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 451 | if (mux_idx >= spec->num_mux_defs) |
| 452 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 453 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 454 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 455 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
| 463 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 464 | |
| 465 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 466 | return 0; |
| 467 | } |
| 468 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 469 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 470 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | { |
| 472 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 473 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 474 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 476 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 477 | hda_nid_t nid = spec->capsrc_nids ? |
| 478 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 479 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 481 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 482 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 483 | if (!imux->num_items && mux_idx > 0) |
| 484 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 485 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 486 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 487 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 488 | /* Matrix-mixer style (e.g. ALC882) */ |
| 489 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 490 | unsigned int i, idx; |
| 491 | |
| 492 | idx = ucontrol->value.enumerated.item[0]; |
| 493 | if (idx >= imux->num_items) |
| 494 | idx = imux->num_items - 1; |
| 495 | if (*cur_val == idx) |
| 496 | return 0; |
| 497 | for (i = 0; i < imux->num_items; i++) { |
| 498 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 499 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 500 | imux->items[i].index, |
| 501 | HDA_AMP_MUTE, v); |
| 502 | } |
| 503 | *cur_val = idx; |
| 504 | return 1; |
| 505 | } else { |
| 506 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 507 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 508 | &spec->cur_mux[adc_idx]); |
| 509 | } |
| 510 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 511 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | /* |
| 513 | * channel mode setting |
| 514 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 515 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 516 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 | { |
| 518 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 519 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 520 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 521 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | } |
| 523 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 524 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 525 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | { |
| 527 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 528 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 529 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 531 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | } |
| 533 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 535 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | { |
| 537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 538 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 539 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 540 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 541 | &spec->ext_channel_count); |
| 542 | if (err >= 0 && !spec->const_channel_count) { |
| 543 | spec->multiout.max_channels = spec->ext_channel_count; |
| 544 | if (spec->need_dac_fix) |
| 545 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 546 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 547 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | } |
| 549 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 551 | * 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] | 552 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 553 | * being part of a format specifier. Maximum allowed length of a value is |
| 554 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 555 | * |
| 556 | * Note: some retasking pin complexes seem to ignore requests for input |
| 557 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 558 | * are requested. Therefore order this list so that this behaviour will not |
| 559 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 560 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 561 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 562 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 564 | "Mic 50pc bias", "Mic 80pc bias", |
| 565 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | }; |
| 567 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 568 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 569 | }; |
| 570 | /* 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] | 571 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 572 | * addition, "input" pins may or may not process the mic bias option |
| 573 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 574 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 575 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 577 | #define ALC_PIN_DIR_IN 0x00 |
| 578 | #define ALC_PIN_DIR_OUT 0x01 |
| 579 | #define ALC_PIN_DIR_INOUT 0x02 |
| 580 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 581 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 583 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 584 | * For each direction the minimum and maximum values are given. |
| 585 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 586 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 587 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 588 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 589 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 590 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 591 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | }; |
| 593 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 594 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 595 | #define alc_pin_mode_n_items(_dir) \ |
| 596 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 597 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 598 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 599 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 600 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 601 | unsigned int item_num = uinfo->value.enumerated.item; |
| 602 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 603 | |
| 604 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 605 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 606 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 607 | |
| 608 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 609 | item_num = alc_pin_mode_min(dir); |
| 610 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 611 | return 0; |
| 612 | } |
| 613 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 614 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 615 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 616 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 617 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 618 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 619 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 620 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 621 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 622 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 623 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 624 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 625 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 626 | /* Find enumerated value for current pinctl setting */ |
| 627 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 628 | 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] | 629 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 630 | *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] | 631 | return 0; |
| 632 | } |
| 633 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 634 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 635 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 636 | { |
| 637 | signed int change; |
| 638 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 639 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 640 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 641 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 642 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 643 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 644 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 645 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 646 | 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] | 647 | val = alc_pin_mode_min(dir); |
| 648 | |
| 649 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 650 | if (change) { |
| 651 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 652 | snd_hda_codec_write_cache(codec, nid, 0, |
| 653 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 654 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 655 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 656 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 657 | * for the requested pin mode. Enum values of 2 or less are |
| 658 | * input modes. |
| 659 | * |
| 660 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 661 | * reduces noise slightly (particularly on input) so we'll |
| 662 | * do it. However, having both input and output buffers |
| 663 | * enabled simultaneously doesn't seem to be problematic if |
| 664 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 665 | */ |
| 666 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 667 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 668 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 669 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 670 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 671 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 672 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 673 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 674 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 675 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 676 | } |
| 677 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 678 | return change; |
| 679 | } |
| 680 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 681 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 682 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 683 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 684 | .info = alc_pin_mode_info, \ |
| 685 | .get = alc_pin_mode_get, \ |
| 686 | .put = alc_pin_mode_put, \ |
| 687 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 688 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 689 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 690 | * together using a mask with more than one bit set. This control is |
| 691 | * currently used only by the ALC260 test model. At this stage they are not |
| 692 | * needed for any "production" models. |
| 693 | */ |
| 694 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 695 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 696 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 697 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 698 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 699 | { |
| 700 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 701 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 702 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 703 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 704 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 705 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 706 | |
| 707 | *valp = (val & mask) != 0; |
| 708 | return 0; |
| 709 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 710 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 711 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 712 | { |
| 713 | signed int change; |
| 714 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 715 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 716 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 717 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 718 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 719 | AC_VERB_GET_GPIO_DATA, |
| 720 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 721 | |
| 722 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 723 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 724 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 725 | gpio_data &= ~mask; |
| 726 | else |
| 727 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 728 | snd_hda_codec_write_cache(codec, nid, 0, |
| 729 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 730 | |
| 731 | return change; |
| 732 | } |
| 733 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 734 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 735 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 736 | .info = alc_gpio_data_info, \ |
| 737 | .get = alc_gpio_data_get, \ |
| 738 | .put = alc_gpio_data_put, \ |
| 739 | .private_value = nid | (mask<<16) } |
| 740 | #endif /* CONFIG_SND_DEBUG */ |
| 741 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 742 | /* A switch control to allow the enabling of the digital IO pins on the |
| 743 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 744 | * to provide something in the test model allowing digital outputs to be |
| 745 | * identified if present. If models are found which can utilise these |
| 746 | * outputs a more complete mixer control can be devised for those models if |
| 747 | * necessary. |
| 748 | */ |
| 749 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 750 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 751 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 752 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 753 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 754 | { |
| 755 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 756 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 757 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 758 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 759 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 760 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 761 | |
| 762 | *valp = (val & mask) != 0; |
| 763 | return 0; |
| 764 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 765 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 766 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 767 | { |
| 768 | signed int change; |
| 769 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 770 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 771 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 772 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 773 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 774 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 775 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 776 | |
| 777 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 778 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 779 | if (val==0) |
| 780 | ctrl_data &= ~mask; |
| 781 | else |
| 782 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 783 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 784 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 785 | |
| 786 | return change; |
| 787 | } |
| 788 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 789 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 790 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 791 | .info = alc_spdif_ctrl_info, \ |
| 792 | .get = alc_spdif_ctrl_get, \ |
| 793 | .put = alc_spdif_ctrl_put, \ |
| 794 | .private_value = nid | (mask<<16) } |
| 795 | #endif /* CONFIG_SND_DEBUG */ |
| 796 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 797 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 798 | * Again, this is only used in the ALC26x test models to help identify when |
| 799 | * the EAPD line must be asserted for features to work. |
| 800 | */ |
| 801 | #ifdef CONFIG_SND_DEBUG |
| 802 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 803 | |
| 804 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 805 | struct snd_ctl_elem_value *ucontrol) |
| 806 | { |
| 807 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 808 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 809 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 810 | long *valp = ucontrol->value.integer.value; |
| 811 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 812 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 813 | |
| 814 | *valp = (val & mask) != 0; |
| 815 | return 0; |
| 816 | } |
| 817 | |
| 818 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 819 | struct snd_ctl_elem_value *ucontrol) |
| 820 | { |
| 821 | int change; |
| 822 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 823 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 824 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 825 | long val = *ucontrol->value.integer.value; |
| 826 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 827 | AC_VERB_GET_EAPD_BTLENABLE, |
| 828 | 0x00); |
| 829 | |
| 830 | /* Set/unset the masked control bit(s) as needed */ |
| 831 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 832 | if (!val) |
| 833 | ctrl_data &= ~mask; |
| 834 | else |
| 835 | ctrl_data |= mask; |
| 836 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 837 | ctrl_data); |
| 838 | |
| 839 | return change; |
| 840 | } |
| 841 | |
| 842 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 843 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 844 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 845 | .info = alc_eapd_ctrl_info, \ |
| 846 | .get = alc_eapd_ctrl_get, \ |
| 847 | .put = alc_eapd_ctrl_put, \ |
| 848 | .private_value = nid | (mask<<16) } |
| 849 | #endif /* CONFIG_SND_DEBUG */ |
| 850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 851 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 852 | * set up the input pin config (depending on the given auto-pin type) |
| 853 | */ |
| 854 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 855 | int auto_pin_type) |
| 856 | { |
| 857 | unsigned int val = PIN_IN; |
| 858 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 859 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 860 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 861 | unsigned int oldval; |
| 862 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 863 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 864 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 865 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 866 | /* if the default pin setup is vref50, we give it priority */ |
| 867 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 868 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 869 | else if (pincap & AC_PINCAP_VREF_50) |
| 870 | val = PIN_VREF50; |
| 871 | else if (pincap & AC_PINCAP_VREF_100) |
| 872 | val = PIN_VREF100; |
| 873 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 874 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 875 | } |
| 876 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 877 | } |
| 878 | |
| 879 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 880 | */ |
| 881 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 882 | { |
| 883 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 884 | return; |
| 885 | spec->mixers[spec->num_mixers++] = mix; |
| 886 | } |
| 887 | |
| 888 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 889 | { |
| 890 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 891 | return; |
| 892 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 893 | } |
| 894 | |
| 895 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 896 | * set up from the preset table |
| 897 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 898 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 899 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 900 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 901 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 902 | int i; |
| 903 | |
| 904 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 905 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 906 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 907 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 908 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 909 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 910 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 911 | spec->channel_mode = preset->channel_mode; |
| 912 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 913 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 914 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 915 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 916 | if (preset->const_channel_count) |
| 917 | spec->multiout.max_channels = preset->const_channel_count; |
| 918 | else |
| 919 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 920 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 921 | |
| 922 | spec->multiout.num_dacs = preset->num_dacs; |
| 923 | spec->multiout.dac_nids = preset->dac_nids; |
| 924 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 925 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 926 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 927 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 928 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 929 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 930 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 931 | spec->input_mux = preset->input_mux; |
| 932 | |
| 933 | spec->num_adc_nids = preset->num_adc_nids; |
| 934 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 935 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 936 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 937 | |
| 938 | spec->unsol_event = preset->unsol_event; |
| 939 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 940 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 941 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 942 | spec->loopback.amplist = preset->loopbacks; |
| 943 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 944 | |
| 945 | if (preset->setup) |
| 946 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 947 | } |
| 948 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 949 | /* Enable GPIO mask and set output */ |
| 950 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 951 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 952 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 953 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 954 | { } |
| 955 | }; |
| 956 | |
| 957 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 958 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 959 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 960 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 961 | { } |
| 962 | }; |
| 963 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 964 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 965 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 966 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 967 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 968 | { } |
| 969 | }; |
| 970 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 971 | /* |
| 972 | * Fix hardware PLL issue |
| 973 | * On some codecs, the analog PLL gating control must be off while |
| 974 | * the default value is 1. |
| 975 | */ |
| 976 | static void alc_fix_pll(struct hda_codec *codec) |
| 977 | { |
| 978 | struct alc_spec *spec = codec->spec; |
| 979 | unsigned int val; |
| 980 | |
| 981 | if (!spec->pll_nid) |
| 982 | return; |
| 983 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 984 | spec->pll_coef_idx); |
| 985 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 986 | AC_VERB_GET_PROC_COEF, 0); |
| 987 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 988 | spec->pll_coef_idx); |
| 989 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 990 | val & ~(1 << spec->pll_coef_bit)); |
| 991 | } |
| 992 | |
| 993 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 994 | unsigned int coef_idx, unsigned int coef_bit) |
| 995 | { |
| 996 | struct alc_spec *spec = codec->spec; |
| 997 | spec->pll_nid = nid; |
| 998 | spec->pll_coef_idx = coef_idx; |
| 999 | spec->pll_coef_bit = coef_bit; |
| 1000 | alc_fix_pll(codec); |
| 1001 | } |
| 1002 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1003 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
| 1004 | static void alc_free_jack_priv(struct snd_jack *jack) |
| 1005 | { |
| 1006 | struct alc_jack *jacks = jack->private_data; |
| 1007 | jacks->nid = 0; |
| 1008 | jacks->jack = NULL; |
| 1009 | } |
| 1010 | |
| 1011 | static int alc_add_jack(struct hda_codec *codec, |
| 1012 | hda_nid_t nid, int type) |
| 1013 | { |
| 1014 | struct alc_spec *spec; |
| 1015 | struct alc_jack *jack; |
| 1016 | const char *name; |
| 1017 | int err; |
| 1018 | |
| 1019 | spec = codec->spec; |
| 1020 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 1021 | jack = snd_array_new(&spec->jacks); |
| 1022 | if (!jack) |
| 1023 | return -ENOMEM; |
| 1024 | |
| 1025 | jack->nid = nid; |
| 1026 | jack->type = type; |
| 1027 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
| 1028 | |
| 1029 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); |
| 1030 | if (err < 0) |
| 1031 | return err; |
| 1032 | jack->jack->private_data = jack; |
| 1033 | jack->jack->private_free = alc_free_jack_priv; |
| 1034 | return 0; |
| 1035 | } |
| 1036 | |
| 1037 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1038 | { |
| 1039 | struct alc_spec *spec = codec->spec; |
| 1040 | struct alc_jack *jacks = spec->jacks.list; |
| 1041 | |
| 1042 | if (jacks) { |
| 1043 | int i; |
| 1044 | for (i = 0; i < spec->jacks.used; i++) { |
| 1045 | if (jacks->nid == nid) { |
| 1046 | unsigned int present; |
| 1047 | present = snd_hda_jack_detect(codec, nid); |
| 1048 | |
| 1049 | present = (present) ? jacks->type : 0; |
| 1050 | |
| 1051 | snd_jack_report(jacks->jack, present); |
| 1052 | } |
| 1053 | jacks++; |
| 1054 | } |
| 1055 | } |
| 1056 | } |
| 1057 | |
| 1058 | static int alc_init_jacks(struct hda_codec *codec) |
| 1059 | { |
| 1060 | struct alc_spec *spec = codec->spec; |
| 1061 | int err; |
| 1062 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1063 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1064 | |
| 1065 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); |
| 1066 | if (err < 0) |
| 1067 | return err; |
| 1068 | alc_report_jack(codec, hp_nid); |
| 1069 | |
| 1070 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); |
| 1071 | if (err < 0) |
| 1072 | return err; |
| 1073 | alc_report_jack(codec, mic_nid); |
| 1074 | |
| 1075 | return 0; |
| 1076 | } |
| 1077 | #else |
| 1078 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1079 | { |
| 1080 | } |
| 1081 | |
| 1082 | static inline int alc_init_jacks(struct hda_codec *codec) |
| 1083 | { |
| 1084 | return 0; |
| 1085 | } |
| 1086 | #endif |
| 1087 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1088 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1089 | { |
| 1090 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1091 | unsigned int mute; |
| 1092 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1093 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1094 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1095 | spec->jack_present = 0; |
| 1096 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1097 | nid = spec->autocfg.hp_pins[i]; |
| 1098 | if (!nid) |
| 1099 | break; |
| 1100 | if (snd_hda_jack_detect(codec, nid)) { |
| 1101 | spec->jack_present = 1; |
| 1102 | break; |
| 1103 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1104 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1105 | } |
| 1106 | |
| 1107 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1108 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1109 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1110 | nid = spec->autocfg.speaker_pins[i]; |
| 1111 | if (!nid) |
| 1112 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1113 | if (pinctl) { |
| 1114 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1115 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1116 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1117 | } else { |
| 1118 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1119 | HDA_AMP_MUTE, mute); |
| 1120 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1121 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1122 | } |
| 1123 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1124 | static void alc_automute_pin(struct hda_codec *codec) |
| 1125 | { |
| 1126 | alc_automute_speaker(codec, 1); |
| 1127 | } |
| 1128 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1129 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1130 | hda_nid_t nid) |
| 1131 | { |
| 1132 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1133 | int i, nums; |
| 1134 | |
| 1135 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1136 | for (i = 0; i < nums; i++) |
| 1137 | if (conn[i] == nid) |
| 1138 | return i; |
| 1139 | return -1; |
| 1140 | } |
| 1141 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1142 | /* switch the current ADC according to the jack state */ |
| 1143 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1144 | { |
| 1145 | struct alc_spec *spec = codec->spec; |
| 1146 | unsigned int present; |
| 1147 | hda_nid_t new_adc; |
| 1148 | |
| 1149 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1150 | if (present) |
| 1151 | spec->cur_adc_idx = 1; |
| 1152 | else |
| 1153 | spec->cur_adc_idx = 0; |
| 1154 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1155 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1156 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1157 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1158 | spec->cur_adc = new_adc; |
| 1159 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1160 | spec->cur_adc_stream_tag, 0, |
| 1161 | spec->cur_adc_format); |
| 1162 | } |
| 1163 | } |
| 1164 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1165 | static void alc_mic_automute(struct hda_codec *codec) |
| 1166 | { |
| 1167 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1168 | struct alc_mic_route *dead, *alive; |
| 1169 | unsigned int present, type; |
| 1170 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1171 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1172 | if (!spec->auto_mic) |
| 1173 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1174 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1175 | return; |
| 1176 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1177 | return; |
| 1178 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1179 | if (spec->dual_adc_switch) { |
| 1180 | alc_dual_mic_adc_auto_switch(codec); |
| 1181 | return; |
| 1182 | } |
| 1183 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1184 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1185 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1186 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1187 | if (present) { |
| 1188 | alive = &spec->ext_mic; |
| 1189 | dead = &spec->int_mic; |
| 1190 | } else { |
| 1191 | alive = &spec->int_mic; |
| 1192 | dead = &spec->ext_mic; |
| 1193 | } |
| 1194 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1195 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1196 | if (type == AC_WID_AUD_MIX) { |
| 1197 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1198 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1199 | alive->mux_idx, |
| 1200 | HDA_AMP_MUTE, 0); |
| 1201 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1202 | dead->mux_idx, |
| 1203 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1204 | } else { |
| 1205 | /* MUX style (e.g. ALC880) */ |
| 1206 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1207 | AC_VERB_SET_CONNECT_SEL, |
| 1208 | alive->mux_idx); |
| 1209 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1210 | alc_report_jack(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1211 | |
| 1212 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1213 | } |
| 1214 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1215 | /* unsolicited event for HP jack sensing */ |
| 1216 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1217 | { |
| 1218 | if (codec->vendor_id == 0x10ec0880) |
| 1219 | res >>= 28; |
| 1220 | else |
| 1221 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1222 | switch (res) { |
| 1223 | case ALC880_HP_EVENT: |
| 1224 | alc_automute_pin(codec); |
| 1225 | break; |
| 1226 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1227 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1228 | break; |
| 1229 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1230 | } |
| 1231 | |
| 1232 | static void alc_inithook(struct hda_codec *codec) |
| 1233 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1234 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1235 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1236 | } |
| 1237 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1238 | /* additional initialization for ALC888 variants */ |
| 1239 | static void alc888_coef_init(struct hda_codec *codec) |
| 1240 | { |
| 1241 | unsigned int tmp; |
| 1242 | |
| 1243 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1244 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1245 | 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] | 1246 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1247 | /* alc888S-VC */ |
| 1248 | snd_hda_codec_read(codec, 0x20, 0, |
| 1249 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1250 | else |
| 1251 | /* alc888-VB */ |
| 1252 | snd_hda_codec_read(codec, 0x20, 0, |
| 1253 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1254 | } |
| 1255 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1256 | static void alc889_coef_init(struct hda_codec *codec) |
| 1257 | { |
| 1258 | unsigned int tmp; |
| 1259 | |
| 1260 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1261 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1262 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1263 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1264 | } |
| 1265 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1266 | /* turn on/off EAPD control (only if available) */ |
| 1267 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1268 | { |
| 1269 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1270 | return; |
| 1271 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1272 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1273 | on ? 2 : 0); |
| 1274 | } |
| 1275 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1276 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1277 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1278 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1279 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1280 | switch (type) { |
| 1281 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1282 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1283 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1284 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1285 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1286 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1287 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1288 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1289 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1290 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1291 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1292 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1293 | set_eapd(codec, 0x0f, 1); |
| 1294 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1295 | break; |
| 1296 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1297 | case 0x10ec0267: |
| 1298 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1299 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1300 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1301 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1302 | case 0x10ec0660: |
| 1303 | case 0x10ec0662: |
| 1304 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1305 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1306 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1307 | set_eapd(codec, 0x14, 1); |
| 1308 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1309 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1310 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1311 | switch (codec->vendor_id) { |
| 1312 | case 0x10ec0260: |
| 1313 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1314 | AC_VERB_SET_COEF_INDEX, 7); |
| 1315 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1316 | AC_VERB_GET_PROC_COEF, 0); |
| 1317 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1318 | AC_VERB_SET_COEF_INDEX, 7); |
| 1319 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1320 | AC_VERB_SET_PROC_COEF, |
| 1321 | tmp | 0x2010); |
| 1322 | break; |
| 1323 | case 0x10ec0262: |
| 1324 | case 0x10ec0880: |
| 1325 | case 0x10ec0882: |
| 1326 | case 0x10ec0883: |
| 1327 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1328 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1329 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1330 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1331 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1332 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1333 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1334 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1335 | #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] | 1336 | case 0x10ec0267: |
| 1337 | case 0x10ec0268: |
| 1338 | snd_hda_codec_write(codec, 0x20, 0, |
| 1339 | AC_VERB_SET_COEF_INDEX, 7); |
| 1340 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1341 | AC_VERB_GET_PROC_COEF, 0); |
| 1342 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1343 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1344 | snd_hda_codec_write(codec, 0x20, 0, |
| 1345 | AC_VERB_SET_PROC_COEF, |
| 1346 | tmp | 0x3000); |
| 1347 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1348 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1349 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1350 | break; |
| 1351 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1352 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1353 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1354 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1355 | { |
| 1356 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1357 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1358 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1359 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1360 | if (!cfg->hp_pins[0]) { |
| 1361 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1362 | return; |
| 1363 | } |
| 1364 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1365 | if (!cfg->speaker_pins[0]) { |
| 1366 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1367 | return; |
| 1368 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1369 | sizeof(cfg->speaker_pins)); |
| 1370 | cfg->speaker_outs = cfg->line_outs; |
| 1371 | } |
| 1372 | |
| 1373 | if (!cfg->hp_pins[0]) { |
| 1374 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1375 | sizeof(cfg->hp_pins)); |
| 1376 | cfg->hp_outs = cfg->line_outs; |
| 1377 | } |
| 1378 | |
| 1379 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1380 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1381 | cfg->hp_pins[i]); |
| 1382 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1383 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1384 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1385 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1386 | spec->unsol_event = alc_sku_unsol_event; |
| 1387 | } |
| 1388 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1389 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1390 | { |
| 1391 | struct alc_spec *spec = codec->spec; |
| 1392 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1393 | hda_nid_t fixed, ext; |
| 1394 | int i; |
| 1395 | |
| 1396 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1397 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1398 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1399 | return; |
| 1400 | |
| 1401 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1402 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1403 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1404 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1405 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1406 | switch (get_defcfg_connect(defcfg)) { |
| 1407 | case AC_JACK_PORT_FIXED: |
| 1408 | if (fixed) |
| 1409 | return; /* already occupied */ |
| 1410 | fixed = nid; |
| 1411 | break; |
| 1412 | case AC_JACK_PORT_COMPLEX: |
| 1413 | if (ext) |
| 1414 | return; /* already occupied */ |
| 1415 | ext = nid; |
| 1416 | break; |
| 1417 | default: |
| 1418 | return; /* invalid entry */ |
| 1419 | } |
| 1420 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1421 | if (!ext || !fixed) |
| 1422 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1423 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1424 | return; /* no unsol support */ |
| 1425 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1426 | ext, fixed); |
| 1427 | spec->ext_mic.pin = ext; |
| 1428 | spec->int_mic.pin = fixed; |
| 1429 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1430 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1431 | spec->auto_mic = 1; |
| 1432 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1433 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1434 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1435 | spec->unsol_event = alc_sku_unsol_event; |
| 1436 | } |
| 1437 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1438 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1439 | { |
| 1440 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1441 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1442 | struct alc_spec *spec = codec->spec; |
| 1443 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1444 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1445 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1446 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1447 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1448 | goto do_sku; |
| 1449 | |
| 1450 | nid = 0x1d; |
| 1451 | if (codec->vendor_id == 0x10ec0260) |
| 1452 | nid = 0x17; |
| 1453 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1454 | |
| 1455 | if (!(ass & 1)) { |
| 1456 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1457 | codec->chip_name, ass); |
| 1458 | return -1; |
| 1459 | } |
| 1460 | |
| 1461 | /* check sum */ |
| 1462 | tmp = 0; |
| 1463 | for (i = 1; i < 16; i++) { |
| 1464 | if ((ass >> i) & 1) |
| 1465 | tmp++; |
| 1466 | } |
| 1467 | if (((ass >> 16) & 0xf) != tmp) |
| 1468 | return -1; |
| 1469 | |
| 1470 | spec->cdefine.port_connectivity = ass >> 30; |
| 1471 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1472 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1473 | spec->cdefine.customization = ass >> 8; |
| 1474 | do_sku: |
| 1475 | spec->cdefine.sku_cfg = ass; |
| 1476 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1477 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1478 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1479 | spec->cdefine.override = ass & 0x1; |
| 1480 | |
| 1481 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1482 | nid, spec->cdefine.sku_cfg); |
| 1483 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1484 | spec->cdefine.port_connectivity); |
| 1485 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1486 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1487 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1488 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1489 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1490 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1491 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1492 | |
| 1493 | return 0; |
| 1494 | } |
| 1495 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1496 | /* check subsystem ID and set up device-specific initialization; |
| 1497 | * return 1 if initialized, 0 if invalid SSID |
| 1498 | */ |
| 1499 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1500 | * 31 ~ 16 : Manufacture ID |
| 1501 | * 15 ~ 8 : SKU ID |
| 1502 | * 7 ~ 0 : Assembly ID |
| 1503 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1504 | */ |
| 1505 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1506 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1507 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1508 | { |
| 1509 | unsigned int ass, tmp, i; |
| 1510 | unsigned nid; |
| 1511 | struct alc_spec *spec = codec->spec; |
| 1512 | |
| 1513 | ass = codec->subsystem_id & 0xffff; |
| 1514 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1515 | goto do_sku; |
| 1516 | |
| 1517 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1518 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1519 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1520 | * 29~21 : reserve |
| 1521 | * 20 : PCBEEP input |
| 1522 | * 19~16 : Check sum (15:1) |
| 1523 | * 15~1 : Custom |
| 1524 | * 0 : override |
| 1525 | */ |
| 1526 | nid = 0x1d; |
| 1527 | if (codec->vendor_id == 0x10ec0260) |
| 1528 | nid = 0x17; |
| 1529 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1530 | snd_printd("realtek: No valid SSID, " |
| 1531 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1532 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1533 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1534 | return 0; |
| 1535 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1536 | return 0; |
| 1537 | |
| 1538 | /* check sum */ |
| 1539 | tmp = 0; |
| 1540 | for (i = 1; i < 16; i++) { |
| 1541 | if ((ass >> i) & 1) |
| 1542 | tmp++; |
| 1543 | } |
| 1544 | if (((ass >> 16) & 0xf) != tmp) |
| 1545 | return 0; |
| 1546 | do_sku: |
| 1547 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1548 | ass & 0xffff, codec->vendor_id); |
| 1549 | /* |
| 1550 | * 0 : override |
| 1551 | * 1 : Swap Jack |
| 1552 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1553 | * 3~5 : External Amplifier control |
| 1554 | * 7~6 : Reserved |
| 1555 | */ |
| 1556 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1557 | switch (tmp) { |
| 1558 | case 1: |
| 1559 | spec->init_amp = ALC_INIT_GPIO1; |
| 1560 | break; |
| 1561 | case 3: |
| 1562 | spec->init_amp = ALC_INIT_GPIO2; |
| 1563 | break; |
| 1564 | case 7: |
| 1565 | spec->init_amp = ALC_INIT_GPIO3; |
| 1566 | break; |
| 1567 | case 5: |
| 1568 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1569 | break; |
| 1570 | } |
| 1571 | |
| 1572 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1573 | * when the external headphone out jack is plugged" |
| 1574 | */ |
| 1575 | if (!(ass & 0x8000)) |
| 1576 | return 1; |
| 1577 | /* |
| 1578 | * 10~8 : Jack location |
| 1579 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1580 | * 14~13: Resvered |
| 1581 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1582 | * when the external headphone out jack is plugged" |
| 1583 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1584 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1585 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1586 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1587 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1588 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1589 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1590 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1591 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1592 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1593 | else if (tmp == 3) |
| 1594 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1595 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1596 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1597 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1598 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1599 | return 1; |
| 1600 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1601 | } |
| 1602 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1603 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1604 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1605 | return 1; |
| 1606 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1607 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1608 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1609 | hda_nid_t porta, hda_nid_t porte, |
| 1610 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1611 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1612 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1613 | struct alc_spec *spec = codec->spec; |
| 1614 | snd_printd("realtek: " |
| 1615 | "Enable default setup for auto mode as fallback\n"); |
| 1616 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1617 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1618 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1619 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1620 | } |
| 1621 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1622 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1623 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1624 | */ |
| 1625 | |
| 1626 | struct alc_pincfg { |
| 1627 | hda_nid_t nid; |
| 1628 | u32 val; |
| 1629 | }; |
| 1630 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1631 | struct alc_fixup { |
| 1632 | const struct alc_pincfg *pins; |
| 1633 | const struct hda_verb *verbs; |
| 1634 | }; |
| 1635 | |
| 1636 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1637 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1638 | const struct alc_fixup *fix, |
| 1639 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1640 | { |
| 1641 | const struct alc_pincfg *cfg; |
| 1642 | |
| 1643 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1644 | if (!quirk) |
| 1645 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1646 | fix += quirk->value; |
| 1647 | cfg = fix->pins; |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1648 | if (pre_init && cfg) { |
| 1649 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1650 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1651 | codec->chip_name, quirk->name); |
| 1652 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1653 | for (; cfg->nid; cfg++) |
| 1654 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1655 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1656 | if (!pre_init && fix->verbs) { |
| 1657 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1658 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1659 | codec->chip_name, quirk->name); |
| 1660 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1661 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1662 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1663 | } |
| 1664 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1665 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1666 | unsigned int coef_idx) |
| 1667 | { |
| 1668 | unsigned int val; |
| 1669 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1670 | coef_idx); |
| 1671 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1672 | AC_VERB_GET_PROC_COEF, 0); |
| 1673 | return val; |
| 1674 | } |
| 1675 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1676 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1677 | unsigned int coef_val) |
| 1678 | { |
| 1679 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1680 | coef_idx); |
| 1681 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1682 | coef_val); |
| 1683 | } |
| 1684 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1685 | /* set right pin controls for digital I/O */ |
| 1686 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1687 | { |
| 1688 | struct alc_spec *spec = codec->spec; |
| 1689 | int i; |
| 1690 | hda_nid_t pin; |
| 1691 | |
| 1692 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1693 | pin = spec->autocfg.dig_out_pins[i]; |
| 1694 | if (pin) { |
| 1695 | snd_hda_codec_write(codec, pin, 0, |
| 1696 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1697 | PIN_OUT); |
| 1698 | } |
| 1699 | } |
| 1700 | pin = spec->autocfg.dig_in_pin; |
| 1701 | if (pin) |
| 1702 | snd_hda_codec_write(codec, pin, 0, |
| 1703 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1704 | PIN_IN); |
| 1705 | } |
| 1706 | |
| 1707 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1708 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1709 | { |
| 1710 | struct alc_spec *spec = codec->spec; |
| 1711 | int i, err; |
| 1712 | hda_nid_t dig_nid; |
| 1713 | |
| 1714 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1715 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1716 | err = snd_hda_get_connections(codec, |
| 1717 | spec->autocfg.dig_out_pins[i], |
| 1718 | &dig_nid, 1); |
| 1719 | if (err < 0) |
| 1720 | continue; |
| 1721 | if (!i) { |
| 1722 | spec->multiout.dig_out_nid = dig_nid; |
| 1723 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1724 | } else { |
| 1725 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1726 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1727 | break; |
| 1728 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1729 | } |
| 1730 | } |
| 1731 | |
| 1732 | if (spec->autocfg.dig_in_pin) { |
| 1733 | hda_nid_t dig_nid; |
| 1734 | err = snd_hda_get_connections(codec, |
| 1735 | spec->autocfg.dig_in_pin, |
| 1736 | &dig_nid, 1); |
| 1737 | if (err > 0) |
| 1738 | spec->dig_in_nid = dig_nid; |
| 1739 | } |
| 1740 | } |
| 1741 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1742 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1743 | * ALC888 |
| 1744 | */ |
| 1745 | |
| 1746 | /* |
| 1747 | * 2ch mode |
| 1748 | */ |
| 1749 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1750 | /* Mic-in jack as mic in */ |
| 1751 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1752 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1753 | /* Line-in jack as Line in */ |
| 1754 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1755 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1756 | /* Line-Out as Front */ |
| 1757 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1758 | { } /* end */ |
| 1759 | }; |
| 1760 | |
| 1761 | /* |
| 1762 | * 4ch mode |
| 1763 | */ |
| 1764 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1765 | /* Mic-in jack as mic in */ |
| 1766 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1767 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1768 | /* Line-in jack as Surround */ |
| 1769 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1770 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1771 | /* Line-Out as Front */ |
| 1772 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1773 | { } /* end */ |
| 1774 | }; |
| 1775 | |
| 1776 | /* |
| 1777 | * 6ch mode |
| 1778 | */ |
| 1779 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1780 | /* Mic-in jack as CLFE */ |
| 1781 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1782 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1783 | /* Line-in jack as Surround */ |
| 1784 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1785 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1786 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1787 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1788 | { } /* end */ |
| 1789 | }; |
| 1790 | |
| 1791 | /* |
| 1792 | * 8ch mode |
| 1793 | */ |
| 1794 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1795 | /* Mic-in jack as CLFE */ |
| 1796 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1797 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1798 | /* Line-in jack as Surround */ |
| 1799 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1800 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1801 | /* Line-Out as Side */ |
| 1802 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1803 | { } /* end */ |
| 1804 | }; |
| 1805 | |
| 1806 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1807 | { 2, alc888_4ST_ch2_intel_init }, |
| 1808 | { 4, alc888_4ST_ch4_intel_init }, |
| 1809 | { 6, alc888_4ST_ch6_intel_init }, |
| 1810 | { 8, alc888_4ST_ch8_intel_init }, |
| 1811 | }; |
| 1812 | |
| 1813 | /* |
| 1814 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1815 | */ |
| 1816 | |
| 1817 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1818 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1819 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1820 | /* Connect Internal HP to Front */ |
| 1821 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1822 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1823 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1824 | /* Connect Bass HP to Front */ |
| 1825 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1826 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1827 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1828 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1829 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1830 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1831 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1832 | /* Connect Mic jack to CLFE */ |
| 1833 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1834 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1835 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1836 | /* Connect Line-in jack to Surround */ |
| 1837 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1838 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1839 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1840 | /* Connect HP out jack to Front */ |
| 1841 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1842 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1843 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1844 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1845 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1846 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1847 | {} |
| 1848 | }; |
| 1849 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1850 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1851 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1852 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1853 | } |
| 1854 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1855 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1856 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1857 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1858 | if (codec->vendor_id == 0x10ec0880) |
| 1859 | res >>= 28; |
| 1860 | else |
| 1861 | res >>= 26; |
| 1862 | if (res == ALC880_HP_EVENT) |
| 1863 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1864 | } |
| 1865 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1866 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1867 | { |
| 1868 | struct alc_spec *spec = codec->spec; |
| 1869 | |
| 1870 | spec->autocfg.hp_pins[0] = 0x15; |
| 1871 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1872 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1873 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1874 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1875 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1876 | } |
| 1877 | |
| 1878 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1879 | { |
| 1880 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1881 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1882 | } |
| 1883 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1884 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1885 | { |
| 1886 | struct alc_spec *spec = codec->spec; |
| 1887 | |
| 1888 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1889 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1890 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1891 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1892 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1893 | |
| 1894 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1895 | * ALC888 Acer Aspire 4930G model |
| 1896 | */ |
| 1897 | |
| 1898 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1899 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1900 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1901 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1903 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1904 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1905 | /* Connect Internal HP to front */ |
| 1906 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1907 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1908 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1909 | /* Connect HP out to front */ |
| 1910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1911 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1912 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1913 | { } |
| 1914 | }; |
| 1915 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1916 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1917 | * ALC888 Acer Aspire 6530G model |
| 1918 | */ |
| 1919 | |
| 1920 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1921 | /* Route to built-in subwoofer as well as speakers */ |
| 1922 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1923 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1924 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1925 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1926 | /* Bias voltage on for external mic port */ |
| 1927 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1928 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1929 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1930 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1931 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1932 | /* Enable unsolicited event for HP jack */ |
| 1933 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1934 | /* Enable speaker output */ |
| 1935 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1936 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1937 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1938 | /* Enable headphone output */ |
| 1939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1941 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1942 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1943 | { } |
| 1944 | }; |
| 1945 | |
| 1946 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1947 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1948 | */ |
| 1949 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1950 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1951 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1952 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1953 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1955 | /* Enable unsolicited event for HP jack */ |
| 1956 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1957 | /* Connect Internal Front to Front */ |
| 1958 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1959 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1960 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1961 | /* Connect Internal Rear to Rear */ |
| 1962 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1963 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1964 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1965 | /* Connect Internal CLFE to CLFE */ |
| 1966 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1967 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1968 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1969 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1970 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1971 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1972 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1973 | /* Enable all DACs */ |
| 1974 | /* DAC DISABLE/MUTE 1? */ |
| 1975 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1976 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1977 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1978 | /* DAC DISABLE/MUTE 2? */ |
| 1979 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1980 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1981 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1982 | /* DMIC fix |
| 1983 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1984 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1985 | * makes the signal become a difference/sum signal instead of standard |
| 1986 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1987 | * codec replicate the sum signal to both channels, turning it into a |
| 1988 | * normal mono mic. |
| 1989 | */ |
| 1990 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1991 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1992 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1993 | { } |
| 1994 | }; |
| 1995 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1996 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1997 | /* Front mic only available on one ADC */ |
| 1998 | { |
| 1999 | .num_items = 4, |
| 2000 | .items = { |
| 2001 | { "Mic", 0x0 }, |
| 2002 | { "Line", 0x2 }, |
| 2003 | { "CD", 0x4 }, |
| 2004 | { "Front Mic", 0xb }, |
| 2005 | }, |
| 2006 | }, |
| 2007 | { |
| 2008 | .num_items = 3, |
| 2009 | .items = { |
| 2010 | { "Mic", 0x0 }, |
| 2011 | { "Line", 0x2 }, |
| 2012 | { "CD", 0x4 }, |
| 2013 | }, |
| 2014 | } |
| 2015 | }; |
| 2016 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2017 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2018 | /* Interal mic only available on one ADC */ |
| 2019 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2020 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2021 | .items = { |
| 2022 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2023 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2024 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2025 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2026 | { "Int Mic", 0xb }, |
| 2027 | }, |
| 2028 | }, |
| 2029 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2030 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2031 | .items = { |
| 2032 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2033 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2034 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2035 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2036 | }, |
| 2037 | } |
| 2038 | }; |
| 2039 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2040 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2041 | /* Digital mic only available on first "ADC" */ |
| 2042 | { |
| 2043 | .num_items = 5, |
| 2044 | .items = { |
| 2045 | { "Mic", 0x0 }, |
| 2046 | { "Line", 0x2 }, |
| 2047 | { "CD", 0x4 }, |
| 2048 | { "Front Mic", 0xb }, |
| 2049 | { "Input Mix", 0xa }, |
| 2050 | }, |
| 2051 | }, |
| 2052 | { |
| 2053 | .num_items = 4, |
| 2054 | .items = { |
| 2055 | { "Mic", 0x0 }, |
| 2056 | { "Line", 0x2 }, |
| 2057 | { "CD", 0x4 }, |
| 2058 | { "Input Mix", 0xa }, |
| 2059 | }, |
| 2060 | }, |
| 2061 | { |
| 2062 | .num_items = 4, |
| 2063 | .items = { |
| 2064 | { "Mic", 0x0 }, |
| 2065 | { "Line", 0x2 }, |
| 2066 | { "CD", 0x4 }, |
| 2067 | { "Input Mix", 0xa }, |
| 2068 | }, |
| 2069 | } |
| 2070 | }; |
| 2071 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2072 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2074 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2075 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2076 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2077 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2078 | HDA_OUTPUT), |
| 2079 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2080 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2081 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2082 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2083 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2084 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2085 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2086 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2087 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2088 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2089 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 2090 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2091 | { } /* end */ |
| 2092 | }; |
| 2093 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2094 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2095 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2096 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2097 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2098 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2099 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2100 | HDA_OUTPUT), |
| 2101 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2102 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2103 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2104 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2105 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2106 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2107 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 2108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2109 | { } /* end */ |
| 2110 | }; |
| 2111 | |
| 2112 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2113 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2114 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2115 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2116 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2117 | spec->autocfg.hp_pins[0] = 0x15; |
| 2118 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2119 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2120 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2121 | } |
| 2122 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2123 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2124 | { |
| 2125 | struct alc_spec *spec = codec->spec; |
| 2126 | |
| 2127 | spec->autocfg.hp_pins[0] = 0x15; |
| 2128 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2129 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2130 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2131 | } |
| 2132 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2133 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2134 | { |
| 2135 | struct alc_spec *spec = codec->spec; |
| 2136 | |
| 2137 | spec->autocfg.hp_pins[0] = 0x15; |
| 2138 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2139 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2140 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2141 | } |
| 2142 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2143 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2144 | * ALC880 3-stack model |
| 2145 | * |
| 2146 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2147 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2148 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2149 | */ |
| 2150 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2151 | static hda_nid_t alc880_dac_nids[4] = { |
| 2152 | /* front, rear, clfe, rear_surr */ |
| 2153 | 0x02, 0x05, 0x04, 0x03 |
| 2154 | }; |
| 2155 | |
| 2156 | static hda_nid_t alc880_adc_nids[3] = { |
| 2157 | /* ADC0-2 */ |
| 2158 | 0x07, 0x08, 0x09, |
| 2159 | }; |
| 2160 | |
| 2161 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2162 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2163 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2164 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2165 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2166 | /* ADC1-2 */ |
| 2167 | 0x08, 0x09, |
| 2168 | }; |
| 2169 | |
| 2170 | #define ALC880_DIGOUT_NID 0x06 |
| 2171 | #define ALC880_DIGIN_NID 0x0a |
| 2172 | |
| 2173 | static struct hda_input_mux alc880_capture_source = { |
| 2174 | .num_items = 4, |
| 2175 | .items = { |
| 2176 | { "Mic", 0x0 }, |
| 2177 | { "Front Mic", 0x3 }, |
| 2178 | { "Line", 0x2 }, |
| 2179 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2180 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2181 | }; |
| 2182 | |
| 2183 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2184 | /* 2ch mode */ |
| 2185 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2186 | /* set line-in to input, mute it */ |
| 2187 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2188 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2189 | /* set mic-in to input vref 80%, mute it */ |
| 2190 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2191 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2192 | { } /* end */ |
| 2193 | }; |
| 2194 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2195 | /* 6ch mode */ |
| 2196 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2197 | /* set line-in to output, unmute it */ |
| 2198 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2199 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2200 | /* set mic-in to output, unmute it */ |
| 2201 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2202 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2203 | { } /* end */ |
| 2204 | }; |
| 2205 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2206 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | { 2, alc880_threestack_ch2_init }, |
| 2208 | { 6, alc880_threestack_ch6_init }, |
| 2209 | }; |
| 2210 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2211 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2212 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2213 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2214 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2215 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2216 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2217 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2218 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2219 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2220 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2221 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2222 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2223 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2224 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2225 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2226 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2227 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2228 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2229 | { |
| 2230 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2231 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2232 | .info = alc_ch_mode_info, |
| 2233 | .get = alc_ch_mode_get, |
| 2234 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2235 | }, |
| 2236 | { } /* end */ |
| 2237 | }; |
| 2238 | |
| 2239 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2240 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2241 | struct snd_ctl_elem_info *uinfo) |
| 2242 | { |
| 2243 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2244 | struct alc_spec *spec = codec->spec; |
| 2245 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2246 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2247 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2248 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2249 | HDA_INPUT); |
| 2250 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2251 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2252 | return err; |
| 2253 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2254 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2255 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2256 | unsigned int size, unsigned int __user *tlv) |
| 2257 | { |
| 2258 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2259 | struct alc_spec *spec = codec->spec; |
| 2260 | int err; |
| 2261 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2262 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2263 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2264 | HDA_INPUT); |
| 2265 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2266 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2267 | return err; |
| 2268 | } |
| 2269 | |
| 2270 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2271 | struct snd_ctl_elem_value *ucontrol); |
| 2272 | |
| 2273 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2274 | struct snd_ctl_elem_value *ucontrol, |
| 2275 | getput_call_t func) |
| 2276 | { |
| 2277 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2278 | struct alc_spec *spec = codec->spec; |
| 2279 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2280 | int err; |
| 2281 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2282 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2283 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2284 | 3, 0, HDA_INPUT); |
| 2285 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2286 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2287 | return err; |
| 2288 | } |
| 2289 | |
| 2290 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2291 | struct snd_ctl_elem_value *ucontrol) |
| 2292 | { |
| 2293 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2294 | snd_hda_mixer_amp_volume_get); |
| 2295 | } |
| 2296 | |
| 2297 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2298 | struct snd_ctl_elem_value *ucontrol) |
| 2299 | { |
| 2300 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2301 | snd_hda_mixer_amp_volume_put); |
| 2302 | } |
| 2303 | |
| 2304 | /* capture mixer elements */ |
| 2305 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2306 | |
| 2307 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2308 | struct snd_ctl_elem_value *ucontrol) |
| 2309 | { |
| 2310 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2311 | snd_hda_mixer_amp_switch_get); |
| 2312 | } |
| 2313 | |
| 2314 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2315 | struct snd_ctl_elem_value *ucontrol) |
| 2316 | { |
| 2317 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2318 | snd_hda_mixer_amp_switch_put); |
| 2319 | } |
| 2320 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2321 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2322 | { \ |
| 2323 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2324 | .name = "Capture Switch", \ |
| 2325 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2326 | .count = num, \ |
| 2327 | .info = alc_cap_sw_info, \ |
| 2328 | .get = alc_cap_sw_get, \ |
| 2329 | .put = alc_cap_sw_put, \ |
| 2330 | }, \ |
| 2331 | { \ |
| 2332 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2333 | .name = "Capture Volume", \ |
| 2334 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2335 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2336 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2337 | .count = num, \ |
| 2338 | .info = alc_cap_vol_info, \ |
| 2339 | .get = alc_cap_vol_get, \ |
| 2340 | .put = alc_cap_vol_put, \ |
| 2341 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2342 | } |
| 2343 | |
| 2344 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2345 | { \ |
| 2346 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2347 | /* .name = "Capture Source", */ \ |
| 2348 | .name = "Input Source", \ |
| 2349 | .count = num, \ |
| 2350 | .info = alc_mux_enum_info, \ |
| 2351 | .get = alc_mux_enum_get, \ |
| 2352 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2353 | } |
| 2354 | |
| 2355 | #define DEFINE_CAPMIX(num) \ |
| 2356 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2357 | _DEFINE_CAPMIX(num), \ |
| 2358 | _DEFINE_CAPSRC(num), \ |
| 2359 | { } /* end */ \ |
| 2360 | } |
| 2361 | |
| 2362 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2363 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2364 | _DEFINE_CAPMIX(num), \ |
| 2365 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2366 | } |
| 2367 | |
| 2368 | /* up to three ADCs */ |
| 2369 | DEFINE_CAPMIX(1); |
| 2370 | DEFINE_CAPMIX(2); |
| 2371 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2372 | DEFINE_CAPMIX_NOSRC(1); |
| 2373 | DEFINE_CAPMIX_NOSRC(2); |
| 2374 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2375 | |
| 2376 | /* |
| 2377 | * ALC880 5-stack model |
| 2378 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2379 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2380 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2381 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2382 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2383 | */ |
| 2384 | |
| 2385 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2386 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2387 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2388 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2389 | { } /* end */ |
| 2390 | }; |
| 2391 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2392 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2393 | /* 6ch mode */ |
| 2394 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2395 | /* set line-in to input, mute it */ |
| 2396 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2397 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2398 | { } /* end */ |
| 2399 | }; |
| 2400 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2401 | /* 8ch mode */ |
| 2402 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2403 | /* set line-in to output, unmute it */ |
| 2404 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2405 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2406 | { } /* end */ |
| 2407 | }; |
| 2408 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2409 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2410 | { 6, alc880_fivestack_ch6_init }, |
| 2411 | { 8, alc880_fivestack_ch8_init }, |
| 2412 | }; |
| 2413 | |
| 2414 | |
| 2415 | /* |
| 2416 | * ALC880 6-stack model |
| 2417 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2418 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2419 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2420 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2421 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2422 | */ |
| 2423 | |
| 2424 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2425 | /* front, rear, clfe, rear_surr */ |
| 2426 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2427 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2428 | |
| 2429 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2430 | .num_items = 4, |
| 2431 | .items = { |
| 2432 | { "Mic", 0x0 }, |
| 2433 | { "Front Mic", 0x1 }, |
| 2434 | { "Line", 0x2 }, |
| 2435 | { "CD", 0x4 }, |
| 2436 | }, |
| 2437 | }; |
| 2438 | |
| 2439 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2440 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2441 | { 8, NULL }, |
| 2442 | }; |
| 2443 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2444 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2445 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2446 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2447 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2448 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2449 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2450 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2451 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2452 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2453 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2454 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2455 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2456 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2457 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2458 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2459 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2460 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2461 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2462 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2463 | { |
| 2464 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2465 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2466 | .info = alc_ch_mode_info, |
| 2467 | .get = alc_ch_mode_get, |
| 2468 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2469 | }, |
| 2470 | { } /* end */ |
| 2471 | }; |
| 2472 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2473 | |
| 2474 | /* |
| 2475 | * ALC880 W810 model |
| 2476 | * |
| 2477 | * W810 has rear IO for: |
| 2478 | * Front (DAC 02) |
| 2479 | * Surround (DAC 03) |
| 2480 | * Center/LFE (DAC 04) |
| 2481 | * Digital out (06) |
| 2482 | * |
| 2483 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2484 | * 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] | 2485 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2486 | * There is a variable resistor to control the speaker or headphone |
| 2487 | * volume. This is a hardware-only device without a software API. |
| 2488 | * |
| 2489 | * Plugging headphones in will disable the internal speakers. This is |
| 2490 | * implemented in hardware, not via the driver using jack sense. In |
| 2491 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2492 | * disable both the speakers and headphones. |
| 2493 | * |
| 2494 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2495 | * These may not do anything useful with this driver yet, because I |
| 2496 | * haven't setup any initialization verbs for these yet... |
| 2497 | */ |
| 2498 | |
| 2499 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2500 | /* front, rear/surround, clfe */ |
| 2501 | 0x02, 0x03, 0x04 |
| 2502 | }; |
| 2503 | |
| 2504 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2505 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2506 | { 6, NULL } |
| 2507 | }; |
| 2508 | |
| 2509 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2510 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2511 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2512 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2513 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2514 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2515 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2516 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2517 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2518 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2519 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2520 | { } /* end */ |
| 2521 | }; |
| 2522 | |
| 2523 | |
| 2524 | /* |
| 2525 | * Z710V model |
| 2526 | * |
| 2527 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2528 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2529 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2530 | */ |
| 2531 | |
| 2532 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2533 | 0x02 |
| 2534 | }; |
| 2535 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2536 | |
| 2537 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2538 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2539 | { 2, NULL } |
| 2540 | }; |
| 2541 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2542 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2543 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2544 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2545 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2546 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2547 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2548 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2549 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2550 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2551 | { } /* end */ |
| 2552 | }; |
| 2553 | |
| 2554 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2555 | /* |
| 2556 | * ALC880 F1734 model |
| 2557 | * |
| 2558 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2559 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2560 | */ |
| 2561 | |
| 2562 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2563 | 0x03 |
| 2564 | }; |
| 2565 | #define ALC880_F1734_HP_DAC 0x02 |
| 2566 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2567 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2568 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2569 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2570 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2571 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2572 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2573 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2574 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2575 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2576 | { } /* end */ |
| 2577 | }; |
| 2578 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2579 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2580 | .num_items = 2, |
| 2581 | .items = { |
| 2582 | { "Mic", 0x1 }, |
| 2583 | { "CD", 0x4 }, |
| 2584 | }, |
| 2585 | }; |
| 2586 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2587 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2588 | /* |
| 2589 | * ALC880 ASUS model |
| 2590 | * |
| 2591 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2592 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2593 | * Mic = 0x18, Line = 0x1a |
| 2594 | */ |
| 2595 | |
| 2596 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2597 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2598 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2599 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2600 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2601 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2602 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2603 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2604 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2605 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2608 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2609 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2610 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2611 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2614 | { |
| 2615 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2616 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2617 | .info = alc_ch_mode_info, |
| 2618 | .get = alc_ch_mode_get, |
| 2619 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2620 | }, |
| 2621 | { } /* end */ |
| 2622 | }; |
| 2623 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2624 | /* |
| 2625 | * ALC880 ASUS W1V model |
| 2626 | * |
| 2627 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2628 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2629 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2630 | */ |
| 2631 | |
| 2632 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2633 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2634 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2635 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2636 | { } /* end */ |
| 2637 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2639 | /* TCL S700 */ |
| 2640 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2641 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2642 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2643 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2644 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2645 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2646 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2647 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2648 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2649 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2650 | { } /* end */ |
| 2651 | }; |
| 2652 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2653 | /* Uniwill */ |
| 2654 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2655 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2656 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2657 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2658 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2659 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2660 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2661 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2662 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2663 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2664 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2665 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2666 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2669 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2670 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2671 | { |
| 2672 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2673 | .name = "Channel Mode", |
| 2674 | .info = alc_ch_mode_info, |
| 2675 | .get = alc_ch_mode_get, |
| 2676 | .put = alc_ch_mode_put, |
| 2677 | }, |
| 2678 | { } /* end */ |
| 2679 | }; |
| 2680 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2681 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2682 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2683 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2684 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2685 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2686 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2687 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2688 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2689 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2690 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2691 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2692 | { } /* end */ |
| 2693 | }; |
| 2694 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2695 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2696 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2697 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2698 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2699 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2700 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2701 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2702 | { } /* end */ |
| 2703 | }; |
| 2704 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2705 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2706 | * virtual master controls |
| 2707 | */ |
| 2708 | |
| 2709 | /* |
| 2710 | * slave controls for virtual master |
| 2711 | */ |
| 2712 | static const char *alc_slave_vols[] = { |
| 2713 | "Front Playback Volume", |
| 2714 | "Surround Playback Volume", |
| 2715 | "Center Playback Volume", |
| 2716 | "LFE Playback Volume", |
| 2717 | "Side Playback Volume", |
| 2718 | "Headphone Playback Volume", |
| 2719 | "Speaker Playback Volume", |
| 2720 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2721 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2722 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2723 | NULL, |
| 2724 | }; |
| 2725 | |
| 2726 | static const char *alc_slave_sws[] = { |
| 2727 | "Front Playback Switch", |
| 2728 | "Surround Playback Switch", |
| 2729 | "Center Playback Switch", |
| 2730 | "LFE Playback Switch", |
| 2731 | "Side Playback Switch", |
| 2732 | "Headphone Playback Switch", |
| 2733 | "Speaker Playback Switch", |
| 2734 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2735 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2736 | "Line-Out Playback Switch", |
| 2737 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2738 | NULL, |
| 2739 | }; |
| 2740 | |
| 2741 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2742 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2743 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2744 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2745 | #define NID_MAPPING (-1) |
| 2746 | |
| 2747 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2748 | #define SUBDEV_HP_ (1 << 6) |
| 2749 | #define SUBDEV_LINE_ (2 << 6) |
| 2750 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2751 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2752 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2753 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2754 | static void alc_free_kctls(struct hda_codec *codec); |
| 2755 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2756 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2757 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2758 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2759 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2760 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2761 | { } /* end */ |
| 2762 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2763 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2764 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2765 | static int alc_build_controls(struct hda_codec *codec) |
| 2766 | { |
| 2767 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2768 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2769 | struct snd_kcontrol_new *knew; |
| 2770 | int i, j, err; |
| 2771 | unsigned int u; |
| 2772 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2773 | |
| 2774 | for (i = 0; i < spec->num_mixers; i++) { |
| 2775 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2776 | if (err < 0) |
| 2777 | return err; |
| 2778 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2779 | if (spec->cap_mixer) { |
| 2780 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2781 | if (err < 0) |
| 2782 | return err; |
| 2783 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2784 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2785 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2786 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2787 | if (err < 0) |
| 2788 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2789 | if (!spec->no_analog) { |
| 2790 | err = snd_hda_create_spdif_share_sw(codec, |
| 2791 | &spec->multiout); |
| 2792 | if (err < 0) |
| 2793 | return err; |
| 2794 | spec->multiout.share_spdif = 1; |
| 2795 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2796 | } |
| 2797 | if (spec->dig_in_nid) { |
| 2798 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2799 | if (err < 0) |
| 2800 | return err; |
| 2801 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2802 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2803 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2804 | /* create beep controls if needed */ |
| 2805 | if (spec->beep_amp) { |
| 2806 | struct snd_kcontrol_new *knew; |
| 2807 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2808 | struct snd_kcontrol *kctl; |
| 2809 | kctl = snd_ctl_new1(knew, codec); |
| 2810 | if (!kctl) |
| 2811 | return -ENOMEM; |
| 2812 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2813 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2814 | if (err < 0) |
| 2815 | return err; |
| 2816 | } |
| 2817 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2818 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2819 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2820 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2821 | if (!spec->no_analog && |
| 2822 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2823 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2824 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2825 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2826 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2827 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2828 | if (err < 0) |
| 2829 | return err; |
| 2830 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2831 | if (!spec->no_analog && |
| 2832 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2833 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2834 | NULL, alc_slave_sws); |
| 2835 | if (err < 0) |
| 2836 | return err; |
| 2837 | } |
| 2838 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2839 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2840 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2841 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2842 | if (!kctl) |
| 2843 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2844 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2845 | hda_nid_t *nids = spec->capsrc_nids; |
| 2846 | if (!nids) |
| 2847 | nids = spec->adc_nids; |
| 2848 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 2849 | if (err < 0) |
| 2850 | return err; |
| 2851 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2852 | } |
| 2853 | if (spec->cap_mixer) { |
| 2854 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2855 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2856 | if (kname && strcmp(knew->name, kname) == 0) |
| 2857 | continue; |
| 2858 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2859 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2860 | err = snd_hda_add_nid(codec, kctl, i, |
| 2861 | spec->adc_nids[i]); |
| 2862 | if (err < 0) |
| 2863 | return err; |
| 2864 | } |
| 2865 | } |
| 2866 | } |
| 2867 | |
| 2868 | /* other nid->control mapping */ |
| 2869 | for (i = 0; i < spec->num_mixers; i++) { |
| 2870 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2871 | if (knew->iface != NID_MAPPING) |
| 2872 | continue; |
| 2873 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2874 | if (kctl == NULL) |
| 2875 | continue; |
| 2876 | u = knew->subdevice; |
| 2877 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2878 | nid = u & 0x3f; |
| 2879 | if (nid == 0) |
| 2880 | continue; |
| 2881 | switch (u & 0xc0) { |
| 2882 | case SUBDEV_SPEAKER_: |
| 2883 | nid = spec->autocfg.speaker_pins[nid]; |
| 2884 | break; |
| 2885 | case SUBDEV_LINE_: |
| 2886 | nid = spec->autocfg.line_out_pins[nid]; |
| 2887 | break; |
| 2888 | case SUBDEV_HP_: |
| 2889 | nid = spec->autocfg.hp_pins[nid]; |
| 2890 | break; |
| 2891 | default: |
| 2892 | continue; |
| 2893 | } |
| 2894 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2895 | if (err < 0) |
| 2896 | return err; |
| 2897 | } |
| 2898 | u = knew->private_value; |
| 2899 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2900 | nid = u & 0xff; |
| 2901 | if (nid == 0) |
| 2902 | continue; |
| 2903 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2904 | if (err < 0) |
| 2905 | return err; |
| 2906 | } |
| 2907 | } |
| 2908 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2909 | |
| 2910 | alc_free_kctls(codec); /* no longer needed */ |
| 2911 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2912 | return 0; |
| 2913 | } |
| 2914 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2915 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2916 | /* |
| 2917 | * initialize the codec volumes, etc |
| 2918 | */ |
| 2919 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2920 | /* |
| 2921 | * generic initialization of ADC, input mixers and output mixers |
| 2922 | */ |
| 2923 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2924 | /* |
| 2925 | * Unmute ADC0-2 and set the default input to mic-in |
| 2926 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2927 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2929 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2930 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2931 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2932 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2933 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2934 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2935 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2936 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2937 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2938 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2939 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2940 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2941 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2942 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2943 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2944 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2945 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2946 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2947 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2948 | /* |
| 2949 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2950 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2951 | /* set vol=0 to output mixers */ |
| 2952 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2953 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2954 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2955 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2956 | /* set up input amps for analog loopback */ |
| 2957 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2958 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2960 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2961 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2962 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2963 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2964 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2965 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2966 | |
| 2967 | { } |
| 2968 | }; |
| 2969 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2970 | /* |
| 2971 | * 3-stack pin configuration: |
| 2972 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2973 | */ |
| 2974 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2975 | /* |
| 2976 | * preset connection lists of input pins |
| 2977 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2978 | */ |
| 2979 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2980 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2981 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2982 | |
| 2983 | /* |
| 2984 | * Set pin mode and muting |
| 2985 | */ |
| 2986 | /* set front pin widgets 0x14 for output */ |
| 2987 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2988 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2989 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2990 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2991 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2992 | /* Mic2 (as headphone out) for HP output */ |
| 2993 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2994 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2995 | /* Line In pin widget for input */ |
| 2996 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2997 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2998 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2999 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3000 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3001 | /* CD pin widget for input */ |
| 3002 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3003 | |
| 3004 | { } |
| 3005 | }; |
| 3006 | |
| 3007 | /* |
| 3008 | * 5-stack pin configuration: |
| 3009 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3010 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3011 | */ |
| 3012 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3013 | /* |
| 3014 | * preset connection lists of input pins |
| 3015 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3016 | */ |
| 3017 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3018 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3019 | |
| 3020 | /* |
| 3021 | * Set pin mode and muting |
| 3022 | */ |
| 3023 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3025 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3026 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3027 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3028 | /* unmute pins for output (no gain on this amp) */ |
| 3029 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3030 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3031 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3032 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3033 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3034 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3035 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3036 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3037 | /* Mic2 (as headphone out) for HP output */ |
| 3038 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3039 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3040 | /* Line In pin widget for input */ |
| 3041 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3042 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3043 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3044 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3045 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3046 | /* CD pin widget for input */ |
| 3047 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3048 | |
| 3049 | { } |
| 3050 | }; |
| 3051 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3052 | /* |
| 3053 | * W810 pin configuration: |
| 3054 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3055 | */ |
| 3056 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3057 | /* hphone/speaker input selector: front DAC */ |
| 3058 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3059 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3060 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3061 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3063 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3064 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3065 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3066 | |
| 3067 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3068 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3069 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3070 | { } |
| 3071 | }; |
| 3072 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3073 | /* |
| 3074 | * Z71V pin configuration: |
| 3075 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3076 | */ |
| 3077 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3078 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3079 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3080 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3081 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3082 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3083 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3084 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3085 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3086 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3087 | |
| 3088 | { } |
| 3089 | }; |
| 3090 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3091 | /* |
| 3092 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3093 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3094 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3095 | */ |
| 3096 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3097 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3098 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3099 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3100 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3101 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3102 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3103 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3104 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3105 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3106 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3107 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3108 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3109 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3110 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3111 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3112 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3113 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3114 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3115 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3116 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3117 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3118 | { } |
| 3119 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3120 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3121 | /* |
| 3122 | * Uniwill pin configuration: |
| 3123 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3124 | * line = 0x1a |
| 3125 | */ |
| 3126 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3127 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3128 | |
| 3129 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3130 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3132 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3133 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3134 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3135 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3136 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3137 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3138 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3139 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3140 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3141 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3142 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3143 | |
| 3144 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3145 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3146 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3148 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3149 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3150 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3151 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3152 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3153 | |
| 3154 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3155 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3156 | |
| 3157 | { } |
| 3158 | }; |
| 3159 | |
| 3160 | /* |
| 3161 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3162 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3163 | */ |
| 3164 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3165 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3166 | |
| 3167 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3168 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3170 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3171 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3172 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3173 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3174 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3175 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3176 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3177 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3178 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3179 | |
| 3180 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3181 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3182 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3183 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3184 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3185 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3186 | |
| 3187 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3188 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3189 | |
| 3190 | { } |
| 3191 | }; |
| 3192 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3193 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3194 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3195 | { } |
| 3196 | }; |
| 3197 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3198 | /* auto-toggle front mic */ |
| 3199 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 3200 | { |
| 3201 | unsigned int present; |
| 3202 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3203 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3204 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3205 | bits = present ? HDA_AMP_MUTE : 0; |
| 3206 | 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] | 3207 | } |
| 3208 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3209 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3210 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3211 | struct alc_spec *spec = codec->spec; |
| 3212 | |
| 3213 | spec->autocfg.hp_pins[0] = 0x14; |
| 3214 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3215 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3216 | } |
| 3217 | |
| 3218 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3219 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3220 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3221 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3222 | } |
| 3223 | |
| 3224 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3225 | unsigned int res) |
| 3226 | { |
| 3227 | /* Looks like the unsol event is incompatible with the standard |
| 3228 | * definition. 4bit tag is placed at 28 bit! |
| 3229 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3230 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3231 | case ALC880_MIC_EVENT: |
| 3232 | alc880_uniwill_mic_automute(codec); |
| 3233 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3234 | default: |
| 3235 | alc_automute_amp_unsol_event(codec, res); |
| 3236 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3237 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3238 | } |
| 3239 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3240 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3241 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3242 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3243 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3244 | spec->autocfg.hp_pins[0] = 0x14; |
| 3245 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3246 | } |
| 3247 | |
| 3248 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3249 | { |
| 3250 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3251 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3252 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3253 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3254 | present &= HDA_AMP_VOLMASK; |
| 3255 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3256 | HDA_AMP_VOLMASK, present); |
| 3257 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3258 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3259 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3260 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3261 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3262 | unsigned int res) |
| 3263 | { |
| 3264 | /* Looks like the unsol event is incompatible with the standard |
| 3265 | * definition. 4bit tag is placed at 28 bit! |
| 3266 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3267 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3268 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3269 | else |
| 3270 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3271 | } |
| 3272 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3273 | /* |
| 3274 | * F1734 pin configuration: |
| 3275 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3276 | */ |
| 3277 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3278 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3279 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3280 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3281 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3282 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3283 | |
| 3284 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3285 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3286 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3288 | |
| 3289 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3290 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3291 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3292 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3293 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3294 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3295 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3296 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3297 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3298 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3299 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3300 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3301 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3302 | { } |
| 3303 | }; |
| 3304 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3305 | /* |
| 3306 | * ASUS pin configuration: |
| 3307 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3308 | */ |
| 3309 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3310 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3311 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3312 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3313 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3314 | |
| 3315 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3316 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3317 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3318 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3319 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3320 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3321 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3322 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3323 | |
| 3324 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3325 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3326 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3327 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3328 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3329 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3330 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3331 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3332 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3333 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3334 | { } |
| 3335 | }; |
| 3336 | |
| 3337 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3338 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3339 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3340 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3341 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3342 | /* Clevo m520g init */ |
| 3343 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3344 | /* headphone output */ |
| 3345 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3346 | /* line-out */ |
| 3347 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3348 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3349 | /* Line-in */ |
| 3350 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3351 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3352 | /* CD */ |
| 3353 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3354 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3355 | /* Mic1 (rear panel) */ |
| 3356 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3357 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3358 | /* Mic2 (front panel) */ |
| 3359 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3360 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3361 | /* headphone */ |
| 3362 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3363 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3364 | /* change to EAPD mode */ |
| 3365 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3366 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3367 | |
| 3368 | { } |
| 3369 | }; |
| 3370 | |
| 3371 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3372 | /* change to EAPD mode */ |
| 3373 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3374 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3375 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3376 | /* Headphone output */ |
| 3377 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3378 | /* Front output*/ |
| 3379 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3380 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3381 | |
| 3382 | /* Line In pin widget for input */ |
| 3383 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3384 | /* CD pin widget for input */ |
| 3385 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3386 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3387 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3388 | |
| 3389 | /* change to EAPD mode */ |
| 3390 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3391 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3392 | |
| 3393 | { } |
| 3394 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3395 | |
| 3396 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3397 | * LG m1 express dual |
| 3398 | * |
| 3399 | * Pin assignment: |
| 3400 | * Rear Line-In/Out (blue): 0x14 |
| 3401 | * Build-in Mic-In: 0x15 |
| 3402 | * Speaker-out: 0x17 |
| 3403 | * HP-Out (green): 0x1b |
| 3404 | * Mic-In/Out (red): 0x19 |
| 3405 | * SPDIF-Out: 0x1e |
| 3406 | */ |
| 3407 | |
| 3408 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3409 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3410 | 0x05, 0x02, 0x03 |
| 3411 | }; |
| 3412 | |
| 3413 | /* seems analog CD is not working */ |
| 3414 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3415 | .num_items = 3, |
| 3416 | .items = { |
| 3417 | { "Mic", 0x1 }, |
| 3418 | { "Line", 0x5 }, |
| 3419 | { "Internal Mic", 0x6 }, |
| 3420 | }, |
| 3421 | }; |
| 3422 | |
| 3423 | /* 2,4,6 channel modes */ |
| 3424 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3425 | /* set line-in and mic-in to input */ |
| 3426 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3427 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3428 | { } |
| 3429 | }; |
| 3430 | |
| 3431 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3432 | /* set line-in to out and mic-in to input */ |
| 3433 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3434 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3435 | { } |
| 3436 | }; |
| 3437 | |
| 3438 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3439 | /* set line-in and mic-in to output */ |
| 3440 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3441 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3442 | { } |
| 3443 | }; |
| 3444 | |
| 3445 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3446 | { 2, alc880_lg_ch2_init }, |
| 3447 | { 4, alc880_lg_ch4_init }, |
| 3448 | { 6, alc880_lg_ch6_init }, |
| 3449 | }; |
| 3450 | |
| 3451 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3452 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3453 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3454 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3455 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3456 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3457 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3458 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3459 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3460 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3462 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3463 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3464 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3465 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3466 | { |
| 3467 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3468 | .name = "Channel Mode", |
| 3469 | .info = alc_ch_mode_info, |
| 3470 | .get = alc_ch_mode_get, |
| 3471 | .put = alc_ch_mode_put, |
| 3472 | }, |
| 3473 | { } /* end */ |
| 3474 | }; |
| 3475 | |
| 3476 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3477 | /* set capture source to mic-in */ |
| 3478 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3479 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3480 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3481 | /* mute all amp mixer inputs */ |
| 3482 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3483 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3484 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3485 | /* line-in to input */ |
| 3486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3488 | /* built-in mic */ |
| 3489 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3490 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3491 | /* speaker-out */ |
| 3492 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3493 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3494 | /* mic-in to input */ |
| 3495 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3496 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3497 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3498 | /* HP-out */ |
| 3499 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3500 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3501 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3502 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3503 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3504 | { } |
| 3505 | }; |
| 3506 | |
| 3507 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3508 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3509 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3510 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3511 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3512 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3513 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3514 | } |
| 3515 | |
| 3516 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3517 | * LG LW20 |
| 3518 | * |
| 3519 | * Pin assignment: |
| 3520 | * Speaker-out: 0x14 |
| 3521 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3522 | * Built-in Mic-In: 0x19 |
| 3523 | * Line-In: 0x1b |
| 3524 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3525 | * SPDIF-Out: 0x1e |
| 3526 | */ |
| 3527 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3528 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3529 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3530 | .items = { |
| 3531 | { "Mic", 0x0 }, |
| 3532 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3533 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3534 | }, |
| 3535 | }; |
| 3536 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3537 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3538 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3539 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3540 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3541 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3542 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3543 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3544 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3545 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3546 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3547 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3548 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3549 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3552 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3553 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3554 | { |
| 3555 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3556 | .name = "Channel Mode", |
| 3557 | .info = alc_ch_mode_info, |
| 3558 | .get = alc_ch_mode_get, |
| 3559 | .put = alc_ch_mode_put, |
| 3560 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3561 | { } /* end */ |
| 3562 | }; |
| 3563 | |
| 3564 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3565 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3566 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3567 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3568 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3569 | /* set capture source to mic-in */ |
| 3570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3571 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3572 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3574 | /* speaker-out */ |
| 3575 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3577 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3578 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3579 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3580 | /* mic-in to input */ |
| 3581 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3582 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3583 | /* built-in mic */ |
| 3584 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3585 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3586 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3587 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3588 | { } |
| 3589 | }; |
| 3590 | |
| 3591 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3592 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3593 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3594 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3595 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3596 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3597 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3598 | } |
| 3599 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3600 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3601 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3602 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3605 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3606 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3607 | { } /* end */ |
| 3608 | }; |
| 3609 | |
| 3610 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3611 | .num_items = 2, |
| 3612 | .items = { |
| 3613 | { "Mic", 0x0 }, |
| 3614 | { "Internal Mic", 0x1 }, |
| 3615 | }, |
| 3616 | }; |
| 3617 | |
| 3618 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3619 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3620 | |
| 3621 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3622 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3623 | |
| 3624 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3625 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3626 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3627 | /* Mic2 (as headphone out) for HP output */ |
| 3628 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3629 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3630 | /* Internal Speaker */ |
| 3631 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3632 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3633 | |
| 3634 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3635 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3636 | |
| 3637 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3638 | { } |
| 3639 | }; |
| 3640 | |
| 3641 | /* toggle speaker-output according to the hp-jack state */ |
| 3642 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3643 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3644 | struct alc_spec *spec = codec->spec; |
| 3645 | alc_automute_amp(codec); |
| 3646 | /* toggle EAPD */ |
| 3647 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3648 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3649 | else |
| 3650 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3651 | } |
| 3652 | |
| 3653 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3654 | unsigned int res) |
| 3655 | { |
| 3656 | /* Looks like the unsol event is incompatible with the standard |
| 3657 | * definition. 4bit tag is placed at 28 bit! |
| 3658 | */ |
| 3659 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3660 | alc880_medion_rim_automute(codec); |
| 3661 | } |
| 3662 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3663 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3664 | { |
| 3665 | struct alc_spec *spec = codec->spec; |
| 3666 | |
| 3667 | spec->autocfg.hp_pins[0] = 0x14; |
| 3668 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3669 | } |
| 3670 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3671 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3672 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3673 | { 0x0b, HDA_INPUT, 0 }, |
| 3674 | { 0x0b, HDA_INPUT, 1 }, |
| 3675 | { 0x0b, HDA_INPUT, 2 }, |
| 3676 | { 0x0b, HDA_INPUT, 3 }, |
| 3677 | { 0x0b, HDA_INPUT, 4 }, |
| 3678 | { } /* end */ |
| 3679 | }; |
| 3680 | |
| 3681 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3682 | { 0x0b, HDA_INPUT, 1 }, |
| 3683 | { 0x0b, HDA_INPUT, 6 }, |
| 3684 | { 0x0b, HDA_INPUT, 7 }, |
| 3685 | { } /* end */ |
| 3686 | }; |
| 3687 | #endif |
| 3688 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3689 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3690 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3691 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3692 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3693 | static int alc_init(struct hda_codec *codec) |
| 3694 | { |
| 3695 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3696 | unsigned int i; |
| 3697 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3698 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3699 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3700 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3701 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3702 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3703 | |
| 3704 | if (spec->init_hook) |
| 3705 | spec->init_hook(codec); |
| 3706 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3707 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3708 | if (codec->patch_ops.check_power_status) |
| 3709 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3710 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3711 | return 0; |
| 3712 | } |
| 3713 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3714 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3715 | { |
| 3716 | struct alc_spec *spec = codec->spec; |
| 3717 | |
| 3718 | if (spec->unsol_event) |
| 3719 | spec->unsol_event(codec, res); |
| 3720 | } |
| 3721 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3722 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3723 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3724 | { |
| 3725 | struct alc_spec *spec = codec->spec; |
| 3726 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3727 | } |
| 3728 | #endif |
| 3729 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3730 | /* |
| 3731 | * Analog playback callbacks |
| 3732 | */ |
| 3733 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3734 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3735 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3736 | { |
| 3737 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3738 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3739 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3740 | } |
| 3741 | |
| 3742 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3743 | struct hda_codec *codec, |
| 3744 | unsigned int stream_tag, |
| 3745 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3746 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3747 | { |
| 3748 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3749 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3750 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3751 | } |
| 3752 | |
| 3753 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3754 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3755 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3756 | { |
| 3757 | struct alc_spec *spec = codec->spec; |
| 3758 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3759 | } |
| 3760 | |
| 3761 | /* |
| 3762 | * Digital out |
| 3763 | */ |
| 3764 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3765 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3766 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3767 | { |
| 3768 | struct alc_spec *spec = codec->spec; |
| 3769 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3770 | } |
| 3771 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3772 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3773 | struct hda_codec *codec, |
| 3774 | unsigned int stream_tag, |
| 3775 | unsigned int format, |
| 3776 | struct snd_pcm_substream *substream) |
| 3777 | { |
| 3778 | struct alc_spec *spec = codec->spec; |
| 3779 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3780 | stream_tag, format, substream); |
| 3781 | } |
| 3782 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3783 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3784 | struct hda_codec *codec, |
| 3785 | struct snd_pcm_substream *substream) |
| 3786 | { |
| 3787 | struct alc_spec *spec = codec->spec; |
| 3788 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3789 | } |
| 3790 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3791 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3792 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3793 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3794 | { |
| 3795 | struct alc_spec *spec = codec->spec; |
| 3796 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3797 | } |
| 3798 | |
| 3799 | /* |
| 3800 | * Analog capture |
| 3801 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3802 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3803 | struct hda_codec *codec, |
| 3804 | unsigned int stream_tag, |
| 3805 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3806 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3807 | { |
| 3808 | struct alc_spec *spec = codec->spec; |
| 3809 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3810 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3811 | stream_tag, 0, format); |
| 3812 | return 0; |
| 3813 | } |
| 3814 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3815 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3816 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3817 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3818 | { |
| 3819 | struct alc_spec *spec = codec->spec; |
| 3820 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3821 | snd_hda_codec_cleanup_stream(codec, |
| 3822 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3823 | return 0; |
| 3824 | } |
| 3825 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3826 | /* analog capture with dynamic dual-adc changes */ |
| 3827 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3828 | struct hda_codec *codec, |
| 3829 | unsigned int stream_tag, |
| 3830 | unsigned int format, |
| 3831 | struct snd_pcm_substream *substream) |
| 3832 | { |
| 3833 | struct alc_spec *spec = codec->spec; |
| 3834 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3835 | spec->cur_adc_stream_tag = stream_tag; |
| 3836 | spec->cur_adc_format = format; |
| 3837 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3838 | return 0; |
| 3839 | } |
| 3840 | |
| 3841 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3842 | struct hda_codec *codec, |
| 3843 | struct snd_pcm_substream *substream) |
| 3844 | { |
| 3845 | struct alc_spec *spec = codec->spec; |
| 3846 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 3847 | spec->cur_adc = 0; |
| 3848 | return 0; |
| 3849 | } |
| 3850 | |
| 3851 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 3852 | .substreams = 1, |
| 3853 | .channels_min = 2, |
| 3854 | .channels_max = 2, |
| 3855 | .nid = 0, /* fill later */ |
| 3856 | .ops = { |
| 3857 | .prepare = dualmic_capture_pcm_prepare, |
| 3858 | .cleanup = dualmic_capture_pcm_cleanup |
| 3859 | }, |
| 3860 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3861 | |
| 3862 | /* |
| 3863 | */ |
| 3864 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3865 | .substreams = 1, |
| 3866 | .channels_min = 2, |
| 3867 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3868 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3869 | .ops = { |
| 3870 | .open = alc880_playback_pcm_open, |
| 3871 | .prepare = alc880_playback_pcm_prepare, |
| 3872 | .cleanup = alc880_playback_pcm_cleanup |
| 3873 | }, |
| 3874 | }; |
| 3875 | |
| 3876 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3877 | .substreams = 1, |
| 3878 | .channels_min = 2, |
| 3879 | .channels_max = 2, |
| 3880 | /* NID is set in alc_build_pcms */ |
| 3881 | }; |
| 3882 | |
| 3883 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3884 | .substreams = 1, |
| 3885 | .channels_min = 2, |
| 3886 | .channels_max = 2, |
| 3887 | /* NID is set in alc_build_pcms */ |
| 3888 | }; |
| 3889 | |
| 3890 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3891 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3892 | .channels_min = 2, |
| 3893 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3894 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3895 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3896 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3897 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3898 | }, |
| 3899 | }; |
| 3900 | |
| 3901 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3902 | .substreams = 1, |
| 3903 | .channels_min = 2, |
| 3904 | .channels_max = 2, |
| 3905 | /* NID is set in alc_build_pcms */ |
| 3906 | .ops = { |
| 3907 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3908 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3909 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3910 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3911 | }, |
| 3912 | }; |
| 3913 | |
| 3914 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3915 | .substreams = 1, |
| 3916 | .channels_min = 2, |
| 3917 | .channels_max = 2, |
| 3918 | /* NID is set in alc_build_pcms */ |
| 3919 | }; |
| 3920 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3921 | /* 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] | 3922 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3923 | .substreams = 0, |
| 3924 | .channels_min = 0, |
| 3925 | .channels_max = 0, |
| 3926 | }; |
| 3927 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3928 | static int alc_build_pcms(struct hda_codec *codec) |
| 3929 | { |
| 3930 | struct alc_spec *spec = codec->spec; |
| 3931 | struct hda_pcm *info = spec->pcm_rec; |
| 3932 | int i; |
| 3933 | |
| 3934 | codec->num_pcms = 1; |
| 3935 | codec->pcm_info = info; |
| 3936 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3937 | if (spec->no_analog) |
| 3938 | goto skip_analog; |
| 3939 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3940 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3941 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3942 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3943 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3944 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3945 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3946 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3947 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3948 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3949 | } |
| 3950 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3951 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3952 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3953 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3954 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3955 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3956 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3957 | if (spec->channel_mode) { |
| 3958 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3959 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3960 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3961 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3962 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3963 | } |
| 3964 | } |
| 3965 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3966 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3967 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3968 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3969 | snprintf(spec->stream_name_digital, |
| 3970 | sizeof(spec->stream_name_digital), |
| 3971 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3972 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3973 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3974 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3975 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3976 | if (spec->dig_out_type) |
| 3977 | info->pcm_type = spec->dig_out_type; |
| 3978 | else |
| 3979 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3980 | if (spec->multiout.dig_out_nid && |
| 3981 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3982 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3983 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3984 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3985 | if (spec->dig_in_nid && |
| 3986 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3987 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3988 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3989 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3990 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3991 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3992 | } |
| 3993 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3994 | if (spec->no_analog) |
| 3995 | return 0; |
| 3996 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3997 | /* If the use of more than one ADC is requested for the current |
| 3998 | * model, configure a second analog capture-only PCM. |
| 3999 | */ |
| 4000 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4001 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4002 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4003 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4004 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4005 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4006 | if (spec->alt_dac_nid) { |
| 4007 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4008 | *spec->stream_analog_alt_playback; |
| 4009 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4010 | spec->alt_dac_nid; |
| 4011 | } else { |
| 4012 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4013 | alc_pcm_null_stream; |
| 4014 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4015 | } |
| 4016 | if (spec->num_adc_nids > 1) { |
| 4017 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4018 | *spec->stream_analog_alt_capture; |
| 4019 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4020 | spec->adc_nids[1]; |
| 4021 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4022 | spec->num_adc_nids - 1; |
| 4023 | } else { |
| 4024 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4025 | alc_pcm_null_stream; |
| 4026 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4027 | } |
| 4028 | } |
| 4029 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4030 | return 0; |
| 4031 | } |
| 4032 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4033 | static inline void alc_shutup(struct hda_codec *codec) |
| 4034 | { |
| 4035 | snd_hda_shutup_pins(codec); |
| 4036 | } |
| 4037 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4038 | static void alc_free_kctls(struct hda_codec *codec) |
| 4039 | { |
| 4040 | struct alc_spec *spec = codec->spec; |
| 4041 | |
| 4042 | if (spec->kctls.list) { |
| 4043 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4044 | int i; |
| 4045 | for (i = 0; i < spec->kctls.used; i++) |
| 4046 | kfree(kctl[i].name); |
| 4047 | } |
| 4048 | snd_array_free(&spec->kctls); |
| 4049 | } |
| 4050 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4051 | static void alc_free(struct hda_codec *codec) |
| 4052 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4053 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4054 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4055 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4056 | return; |
| 4057 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4058 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4059 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4060 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4061 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4062 | } |
| 4063 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4064 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4065 | static void alc_power_eapd(struct hda_codec *codec) |
| 4066 | { |
| 4067 | /* We currently only handle front, HP */ |
| 4068 | switch (codec->vendor_id) { |
| 4069 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4070 | set_eapd(codec, 0x0f, 0); |
| 4071 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4072 | break; |
| 4073 | case 0x10ec0262: |
| 4074 | case 0x10ec0267: |
| 4075 | case 0x10ec0268: |
| 4076 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4077 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4078 | case 0x10ec0272: |
| 4079 | case 0x10ec0660: |
| 4080 | case 0x10ec0662: |
| 4081 | case 0x10ec0663: |
| 4082 | case 0x10ec0862: |
| 4083 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4084 | set_eapd(codec, 0x14, 0); |
| 4085 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4086 | break; |
| 4087 | } |
| 4088 | } |
| 4089 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4090 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4091 | { |
| 4092 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4093 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4094 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4095 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4096 | return 0; |
| 4097 | } |
| 4098 | #endif |
| 4099 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4100 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4101 | static int alc_resume(struct hda_codec *codec) |
| 4102 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4103 | codec->patch_ops.init(codec); |
| 4104 | snd_hda_codec_resume_amp(codec); |
| 4105 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 4106 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4107 | if (codec->patch_ops.check_power_status) |
| 4108 | codec->patch_ops.check_power_status(codec, 0x01); |
| 4109 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4110 | return 0; |
| 4111 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4112 | #endif |
| 4113 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4114 | /* |
| 4115 | */ |
| 4116 | static struct hda_codec_ops alc_patch_ops = { |
| 4117 | .build_controls = alc_build_controls, |
| 4118 | .build_pcms = alc_build_pcms, |
| 4119 | .init = alc_init, |
| 4120 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4121 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4122 | #ifdef SND_HDA_NEEDS_RESUME |
| 4123 | .resume = alc_resume, |
| 4124 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4125 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4126 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4127 | .check_power_status = alc_check_power_status, |
| 4128 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4129 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4130 | }; |
| 4131 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4132 | /* replace the codec chip_name with the given string */ |
| 4133 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4134 | { |
| 4135 | kfree(codec->chip_name); |
| 4136 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4137 | if (!codec->chip_name) { |
| 4138 | alc_free(codec); |
| 4139 | return -ENOMEM; |
| 4140 | } |
| 4141 | return 0; |
| 4142 | } |
| 4143 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4144 | /* |
| 4145 | * Test configuration for debugging |
| 4146 | * |
| 4147 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4148 | * enum controls. |
| 4149 | */ |
| 4150 | #ifdef CONFIG_SND_DEBUG |
| 4151 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4152 | 0x02, 0x03, 0x04, 0x05 |
| 4153 | }; |
| 4154 | |
| 4155 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4156 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4157 | .items = { |
| 4158 | { "In-1", 0x0 }, |
| 4159 | { "In-2", 0x1 }, |
| 4160 | { "In-3", 0x2 }, |
| 4161 | { "In-4", 0x3 }, |
| 4162 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4163 | { "Front", 0x5 }, |
| 4164 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4165 | }, |
| 4166 | }; |
| 4167 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4168 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4169 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4170 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4171 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4172 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4173 | }; |
| 4174 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4175 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4176 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4177 | { |
| 4178 | static char *texts[] = { |
| 4179 | "N/A", "Line Out", "HP Out", |
| 4180 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4181 | }; |
| 4182 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4183 | uinfo->count = 1; |
| 4184 | uinfo->value.enumerated.items = 8; |
| 4185 | if (uinfo->value.enumerated.item >= 8) |
| 4186 | uinfo->value.enumerated.item = 7; |
| 4187 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4188 | return 0; |
| 4189 | } |
| 4190 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4191 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4192 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4193 | { |
| 4194 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4195 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4196 | unsigned int pin_ctl, item = 0; |
| 4197 | |
| 4198 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4199 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4200 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4201 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4202 | item = 2; |
| 4203 | else |
| 4204 | item = 1; |
| 4205 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4206 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4207 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4208 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4209 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4210 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4211 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4212 | } |
| 4213 | } |
| 4214 | ucontrol->value.enumerated.item[0] = item; |
| 4215 | return 0; |
| 4216 | } |
| 4217 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4218 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4219 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4220 | { |
| 4221 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4222 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4223 | static unsigned int ctls[] = { |
| 4224 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4225 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4226 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4227 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4228 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4229 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4230 | }; |
| 4231 | unsigned int old_ctl, new_ctl; |
| 4232 | |
| 4233 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4234 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4235 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4236 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4237 | int val; |
| 4238 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4239 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4240 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4241 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4242 | HDA_AMP_MUTE : 0; |
| 4243 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4244 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4245 | return 1; |
| 4246 | } |
| 4247 | return 0; |
| 4248 | } |
| 4249 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4250 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4251 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4252 | { |
| 4253 | static char *texts[] = { |
| 4254 | "Front", "Surround", "CLFE", "Side" |
| 4255 | }; |
| 4256 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4257 | uinfo->count = 1; |
| 4258 | uinfo->value.enumerated.items = 4; |
| 4259 | if (uinfo->value.enumerated.item >= 4) |
| 4260 | uinfo->value.enumerated.item = 3; |
| 4261 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4262 | return 0; |
| 4263 | } |
| 4264 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4265 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4266 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4267 | { |
| 4268 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4269 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4270 | unsigned int sel; |
| 4271 | |
| 4272 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4273 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4274 | return 0; |
| 4275 | } |
| 4276 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4277 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4278 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4279 | { |
| 4280 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4281 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4282 | unsigned int sel; |
| 4283 | |
| 4284 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4285 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4286 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4287 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4288 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4289 | return 1; |
| 4290 | } |
| 4291 | return 0; |
| 4292 | } |
| 4293 | |
| 4294 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4295 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4296 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4297 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4298 | .info = alc_test_pin_ctl_info, \ |
| 4299 | .get = alc_test_pin_ctl_get, \ |
| 4300 | .put = alc_test_pin_ctl_put, \ |
| 4301 | .private_value = nid \ |
| 4302 | } |
| 4303 | |
| 4304 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4305 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4306 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4307 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4308 | .info = alc_test_pin_src_info, \ |
| 4309 | .get = alc_test_pin_src_get, \ |
| 4310 | .put = alc_test_pin_src_put, \ |
| 4311 | .private_value = nid \ |
| 4312 | } |
| 4313 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4314 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4315 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4316 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4317 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4318 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4319 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4320 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4321 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4322 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4323 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4324 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4325 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4326 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4327 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4328 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4329 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4330 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4331 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4332 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4333 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4334 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4335 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4336 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4337 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4338 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4339 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4340 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4341 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4342 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4343 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4344 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4345 | { |
| 4346 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4347 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4348 | .info = alc_ch_mode_info, |
| 4349 | .get = alc_ch_mode_get, |
| 4350 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4351 | }, |
| 4352 | { } /* end */ |
| 4353 | }; |
| 4354 | |
| 4355 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4356 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4357 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4358 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4359 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4360 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4361 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4362 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4363 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4364 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4365 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4367 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4368 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4369 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4370 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4371 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4372 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4373 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4374 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4375 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4376 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4377 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4378 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4379 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4380 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4381 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4382 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4383 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4384 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4385 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4386 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4387 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4388 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4389 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4390 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4391 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4392 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4393 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4394 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4395 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4396 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4397 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4398 | /* Analog input/passthru */ |
| 4399 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4400 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4401 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4402 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4403 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4404 | { } |
| 4405 | }; |
| 4406 | #endif |
| 4407 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4408 | /* |
| 4409 | */ |
| 4410 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4411 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4412 | [ALC880_3ST] = "3stack", |
| 4413 | [ALC880_TCL_S700] = "tcl", |
| 4414 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4415 | [ALC880_CLEVO] = "clevo", |
| 4416 | [ALC880_5ST] = "5stack", |
| 4417 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4418 | [ALC880_W810] = "w810", |
| 4419 | [ALC880_Z71V] = "z71v", |
| 4420 | [ALC880_6ST] = "6stack", |
| 4421 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4422 | [ALC880_ASUS] = "asus", |
| 4423 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4424 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4425 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4426 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4427 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4428 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4429 | [ALC880_F1734] = "F1734", |
| 4430 | [ALC880_LG] = "lg", |
| 4431 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4432 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4433 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4434 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4435 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4436 | [ALC880_AUTO] = "auto", |
| 4437 | }; |
| 4438 | |
| 4439 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4440 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4441 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4442 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4443 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4444 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4445 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4446 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4447 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4448 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4449 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4450 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4451 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4452 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4453 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4454 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4455 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4456 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4457 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4458 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4459 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4460 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4461 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4462 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4463 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4464 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4465 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4466 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4467 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4468 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4469 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4470 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4471 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4472 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4473 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4474 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4475 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4476 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4477 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4478 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4479 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4480 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4481 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4482 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4483 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4484 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4485 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4486 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4487 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4488 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4489 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4490 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4491 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4492 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4493 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4494 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4495 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4496 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4497 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4498 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4499 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4500 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4501 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4502 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4503 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4504 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4505 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4506 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4507 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4508 | /* default Intel */ |
| 4509 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4510 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4511 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4512 | {} |
| 4513 | }; |
| 4514 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4515 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4516 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4517 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4518 | static struct alc_config_preset alc880_presets[] = { |
| 4519 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4520 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4521 | .init_verbs = { alc880_volume_init_verbs, |
| 4522 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4523 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4524 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4525 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4526 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4527 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4528 | .input_mux = &alc880_capture_source, |
| 4529 | }, |
| 4530 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4531 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4532 | .init_verbs = { alc880_volume_init_verbs, |
| 4533 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4534 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4535 | .dac_nids = alc880_dac_nids, |
| 4536 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4537 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4538 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4539 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4540 | .input_mux = &alc880_capture_source, |
| 4541 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4542 | [ALC880_TCL_S700] = { |
| 4543 | .mixers = { alc880_tcl_s700_mixer }, |
| 4544 | .init_verbs = { alc880_volume_init_verbs, |
| 4545 | alc880_pin_tcl_S700_init_verbs, |
| 4546 | alc880_gpio2_init_verbs }, |
| 4547 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4548 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4549 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4550 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4551 | .hp_nid = 0x03, |
| 4552 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4553 | .channel_mode = alc880_2_jack_modes, |
| 4554 | .input_mux = &alc880_capture_source, |
| 4555 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4556 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4557 | .mixers = { alc880_three_stack_mixer, |
| 4558 | alc880_five_stack_mixer}, |
| 4559 | .init_verbs = { alc880_volume_init_verbs, |
| 4560 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4561 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4562 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4563 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4564 | .channel_mode = alc880_fivestack_modes, |
| 4565 | .input_mux = &alc880_capture_source, |
| 4566 | }, |
| 4567 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4568 | .mixers = { alc880_three_stack_mixer, |
| 4569 | alc880_five_stack_mixer }, |
| 4570 | .init_verbs = { alc880_volume_init_verbs, |
| 4571 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4572 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4573 | .dac_nids = alc880_dac_nids, |
| 4574 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4575 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4576 | .channel_mode = alc880_fivestack_modes, |
| 4577 | .input_mux = &alc880_capture_source, |
| 4578 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4579 | [ALC880_6ST] = { |
| 4580 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4581 | .init_verbs = { alc880_volume_init_verbs, |
| 4582 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4583 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4584 | .dac_nids = alc880_6st_dac_nids, |
| 4585 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4586 | .channel_mode = alc880_sixstack_modes, |
| 4587 | .input_mux = &alc880_6stack_capture_source, |
| 4588 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4589 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4590 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4591 | .init_verbs = { alc880_volume_init_verbs, |
| 4592 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4593 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4594 | .dac_nids = alc880_6st_dac_nids, |
| 4595 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4596 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4597 | .channel_mode = alc880_sixstack_modes, |
| 4598 | .input_mux = &alc880_6stack_capture_source, |
| 4599 | }, |
| 4600 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4601 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4602 | .init_verbs = { alc880_volume_init_verbs, |
| 4603 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4604 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4605 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4606 | .dac_nids = alc880_w810_dac_nids, |
| 4607 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4608 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4609 | .channel_mode = alc880_w810_modes, |
| 4610 | .input_mux = &alc880_capture_source, |
| 4611 | }, |
| 4612 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4613 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4614 | .init_verbs = { alc880_volume_init_verbs, |
| 4615 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4616 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4617 | .dac_nids = alc880_z71v_dac_nids, |
| 4618 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4619 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4620 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4621 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4622 | .input_mux = &alc880_capture_source, |
| 4623 | }, |
| 4624 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4625 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4626 | .init_verbs = { alc880_volume_init_verbs, |
| 4627 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4628 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4629 | .dac_nids = alc880_f1734_dac_nids, |
| 4630 | .hp_nid = 0x02, |
| 4631 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4632 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4633 | .input_mux = &alc880_f1734_capture_source, |
| 4634 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4635 | .setup = alc880_uniwill_p53_setup, |
| 4636 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4637 | }, |
| 4638 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4639 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4640 | .init_verbs = { alc880_volume_init_verbs, |
| 4641 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4642 | alc880_gpio1_init_verbs }, |
| 4643 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4644 | .dac_nids = alc880_asus_dac_nids, |
| 4645 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4646 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4647 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4648 | .input_mux = &alc880_capture_source, |
| 4649 | }, |
| 4650 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4651 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4652 | .init_verbs = { alc880_volume_init_verbs, |
| 4653 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4654 | alc880_gpio1_init_verbs }, |
| 4655 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4656 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4657 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4658 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4659 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4660 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4661 | .input_mux = &alc880_capture_source, |
| 4662 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4663 | [ALC880_ASUS_DIG2] = { |
| 4664 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4665 | .init_verbs = { alc880_volume_init_verbs, |
| 4666 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4667 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4668 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4669 | .dac_nids = alc880_asus_dac_nids, |
| 4670 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4671 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4672 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4673 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4674 | .input_mux = &alc880_capture_source, |
| 4675 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4676 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4677 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4678 | .init_verbs = { alc880_volume_init_verbs, |
| 4679 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4680 | alc880_gpio1_init_verbs }, |
| 4681 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4682 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4683 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4684 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4685 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4686 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4687 | .input_mux = &alc880_capture_source, |
| 4688 | }, |
| 4689 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4690 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4691 | .init_verbs = { alc880_volume_init_verbs, |
| 4692 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4693 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4694 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4695 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4696 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4697 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4698 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4699 | .input_mux = &alc880_capture_source, |
| 4700 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4701 | [ALC880_UNIWILL] = { |
| 4702 | .mixers = { alc880_uniwill_mixer }, |
| 4703 | .init_verbs = { alc880_volume_init_verbs, |
| 4704 | alc880_uniwill_init_verbs }, |
| 4705 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4706 | .dac_nids = alc880_asus_dac_nids, |
| 4707 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4708 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4709 | .channel_mode = alc880_threestack_modes, |
| 4710 | .need_dac_fix = 1, |
| 4711 | .input_mux = &alc880_capture_source, |
| 4712 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4713 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4714 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4715 | }, |
| 4716 | [ALC880_UNIWILL_P53] = { |
| 4717 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4718 | .init_verbs = { alc880_volume_init_verbs, |
| 4719 | alc880_uniwill_p53_init_verbs }, |
| 4720 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4721 | .dac_nids = alc880_asus_dac_nids, |
| 4722 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4723 | .channel_mode = alc880_threestack_modes, |
| 4724 | .input_mux = &alc880_capture_source, |
| 4725 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4726 | .setup = alc880_uniwill_p53_setup, |
| 4727 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4728 | }, |
| 4729 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4730 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4731 | .init_verbs = { alc880_volume_init_verbs, |
| 4732 | alc880_uniwill_p53_init_verbs, |
| 4733 | alc880_beep_init_verbs }, |
| 4734 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4735 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4736 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4737 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4738 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4739 | .input_mux = &alc880_capture_source, |
| 4740 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4741 | .setup = alc880_uniwill_p53_setup, |
| 4742 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4743 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4744 | [ALC880_CLEVO] = { |
| 4745 | .mixers = { alc880_three_stack_mixer }, |
| 4746 | .init_verbs = { alc880_volume_init_verbs, |
| 4747 | alc880_pin_clevo_init_verbs }, |
| 4748 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4749 | .dac_nids = alc880_dac_nids, |
| 4750 | .hp_nid = 0x03, |
| 4751 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4752 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4753 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4754 | .input_mux = &alc880_capture_source, |
| 4755 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4756 | [ALC880_LG] = { |
| 4757 | .mixers = { alc880_lg_mixer }, |
| 4758 | .init_verbs = { alc880_volume_init_verbs, |
| 4759 | alc880_lg_init_verbs }, |
| 4760 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4761 | .dac_nids = alc880_lg_dac_nids, |
| 4762 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4763 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4764 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4765 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4766 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4767 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4768 | .setup = alc880_lg_setup, |
| 4769 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4770 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4771 | .loopbacks = alc880_lg_loopbacks, |
| 4772 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4773 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4774 | [ALC880_LG_LW] = { |
| 4775 | .mixers = { alc880_lg_lw_mixer }, |
| 4776 | .init_verbs = { alc880_volume_init_verbs, |
| 4777 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4778 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4779 | .dac_nids = alc880_dac_nids, |
| 4780 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4781 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4782 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4783 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4784 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4785 | .setup = alc880_lg_lw_setup, |
| 4786 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4787 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4788 | [ALC880_MEDION_RIM] = { |
| 4789 | .mixers = { alc880_medion_rim_mixer }, |
| 4790 | .init_verbs = { alc880_volume_init_verbs, |
| 4791 | alc880_medion_rim_init_verbs, |
| 4792 | alc_gpio2_init_verbs }, |
| 4793 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4794 | .dac_nids = alc880_dac_nids, |
| 4795 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4796 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4797 | .channel_mode = alc880_2_jack_modes, |
| 4798 | .input_mux = &alc880_medion_rim_capture_source, |
| 4799 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4800 | .setup = alc880_medion_rim_setup, |
| 4801 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4802 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4803 | #ifdef CONFIG_SND_DEBUG |
| 4804 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4805 | .mixers = { alc880_test_mixer }, |
| 4806 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4807 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4808 | .dac_nids = alc880_test_dac_nids, |
| 4809 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4810 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4811 | .channel_mode = alc880_test_modes, |
| 4812 | .input_mux = &alc880_test_capture_source, |
| 4813 | }, |
| 4814 | #endif |
| 4815 | }; |
| 4816 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4817 | /* |
| 4818 | * Automatic parse of I/O pins from the BIOS configuration |
| 4819 | */ |
| 4820 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4821 | enum { |
| 4822 | ALC_CTL_WIDGET_VOL, |
| 4823 | ALC_CTL_WIDGET_MUTE, |
| 4824 | ALC_CTL_BIND_MUTE, |
| 4825 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4826 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4827 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4828 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4829 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4830 | }; |
| 4831 | |
| 4832 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4833 | 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] | 4834 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4835 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4836 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4837 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4838 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4839 | knew = snd_array_new(&spec->kctls); |
| 4840 | if (!knew) |
| 4841 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4842 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4843 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4844 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4845 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4846 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4847 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4848 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4849 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4850 | return 0; |
| 4851 | } |
| 4852 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4853 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4854 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4855 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4856 | { |
| 4857 | char name[32]; |
| 4858 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4859 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4860 | } |
| 4861 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4862 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4863 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 4864 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4865 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 4866 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 4867 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 4868 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 4869 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4870 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4871 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4872 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4873 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4874 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4875 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4876 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4877 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4878 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4879 | #define ALC880_PIN_CD_NID 0x1c |
| 4880 | |
| 4881 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4882 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4883 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4884 | { |
| 4885 | hda_nid_t nid; |
| 4886 | int assigned[4]; |
| 4887 | int i, j; |
| 4888 | |
| 4889 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4890 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4891 | |
| 4892 | /* check the pins hardwired to audio widget */ |
| 4893 | for (i = 0; i < cfg->line_outs; i++) { |
| 4894 | nid = cfg->line_out_pins[i]; |
| 4895 | if (alc880_is_fixed_pin(nid)) { |
| 4896 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4897 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4898 | assigned[idx] = 1; |
| 4899 | } |
| 4900 | } |
| 4901 | /* left pins can be connect to any audio widget */ |
| 4902 | for (i = 0; i < cfg->line_outs; i++) { |
| 4903 | nid = cfg->line_out_pins[i]; |
| 4904 | if (alc880_is_fixed_pin(nid)) |
| 4905 | continue; |
| 4906 | /* search for an empty channel */ |
| 4907 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4908 | if (!assigned[j]) { |
| 4909 | spec->multiout.dac_nids[i] = |
| 4910 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4911 | assigned[j] = 1; |
| 4912 | break; |
| 4913 | } |
| 4914 | } |
| 4915 | } |
| 4916 | spec->multiout.num_dacs = cfg->line_outs; |
| 4917 | return 0; |
| 4918 | } |
| 4919 | |
| 4920 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4921 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4922 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4923 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4924 | static const char *chname[4] = { |
| 4925 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4926 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4927 | hda_nid_t nid; |
| 4928 | int i, err; |
| 4929 | |
| 4930 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4931 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4932 | continue; |
| 4933 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4934 | if (i == 2) { |
| 4935 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4936 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4937 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4938 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4939 | HDA_OUTPUT)); |
| 4940 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4941 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4942 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4943 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4944 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4945 | HDA_OUTPUT)); |
| 4946 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4948 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4949 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4950 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4951 | HDA_INPUT)); |
| 4952 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4953 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4954 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4955 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4956 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4957 | HDA_INPUT)); |
| 4958 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4959 | return err; |
| 4960 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4961 | const char *pfx; |
| 4962 | if (cfg->line_outs == 1 && |
| 4963 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4964 | pfx = "Speaker"; |
| 4965 | else |
| 4966 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4967 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4968 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4969 | HDA_OUTPUT)); |
| 4970 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4971 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4972 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4973 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4974 | HDA_INPUT)); |
| 4975 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4976 | return err; |
| 4977 | } |
| 4978 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4979 | return 0; |
| 4980 | } |
| 4981 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4982 | /* add playback controls for speaker and HP outputs */ |
| 4983 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4984 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4985 | { |
| 4986 | hda_nid_t nid; |
| 4987 | int err; |
| 4988 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4989 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4990 | return 0; |
| 4991 | |
| 4992 | if (alc880_is_fixed_pin(pin)) { |
| 4993 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4994 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4995 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4996 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4997 | else |
| 4998 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4999 | /* control HP volume/switch on the output mixer amp */ |
| 5000 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5001 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5002 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5003 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5004 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5005 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5006 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5007 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5008 | return err; |
| 5009 | } else if (alc880_is_multi_pin(pin)) { |
| 5010 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5011 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5012 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5013 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5014 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5015 | return err; |
| 5016 | } |
| 5017 | return 0; |
| 5018 | } |
| 5019 | |
| 5020 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5021 | 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] | 5022 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5023 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5024 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5025 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5026 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5027 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5028 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5029 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5030 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5031 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5032 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5033 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5034 | return err; |
| 5035 | return 0; |
| 5036 | } |
| 5037 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5038 | 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] | 5039 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5040 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5041 | return (pincap & AC_PINCAP_IN) != 0; |
| 5042 | } |
| 5043 | |
| 5044 | /* create playback/capture controls for input pins */ |
| 5045 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5046 | const struct auto_pin_cfg *cfg, |
| 5047 | hda_nid_t mixer, |
| 5048 | hda_nid_t cap1, hda_nid_t cap2) |
| 5049 | { |
| 5050 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5051 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5052 | int i, err, idx, type, type_idx = 0; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5053 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5054 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5055 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5056 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5057 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5058 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5059 | if (!alc_is_input_pin(codec, pin)) |
| 5060 | continue; |
| 5061 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5062 | type = cfg->inputs[i].type; |
| 5063 | if (i > 0 && type == cfg->inputs[i - 1].type) |
| 5064 | type_idx++; |
| 5065 | else |
| 5066 | type_idx = 0; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5067 | label = hda_get_autocfg_input_label(codec, cfg, i); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5068 | if (mixer) { |
| 5069 | idx = get_connection_index(codec, mixer, pin); |
| 5070 | if (idx >= 0) { |
| 5071 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5072 | label, type_idx, |
| 5073 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5074 | if (err < 0) |
| 5075 | return err; |
| 5076 | } |
| 5077 | } |
| 5078 | |
| 5079 | if (!cap1) |
| 5080 | continue; |
| 5081 | idx = get_connection_index(codec, cap1, pin); |
| 5082 | if (idx < 0 && cap2) |
| 5083 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5084 | if (idx >= 0) |
| 5085 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5086 | } |
| 5087 | return 0; |
| 5088 | } |
| 5089 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5090 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5091 | const struct auto_pin_cfg *cfg) |
| 5092 | { |
| 5093 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5094 | } |
| 5095 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5096 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5097 | unsigned int pin_type) |
| 5098 | { |
| 5099 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5100 | pin_type); |
| 5101 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5102 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5103 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5104 | } |
| 5105 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5106 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5107 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5108 | int dac_idx) |
| 5109 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5110 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5111 | /* need the manual connection? */ |
| 5112 | if (alc880_is_multi_pin(nid)) { |
| 5113 | struct alc_spec *spec = codec->spec; |
| 5114 | int idx = alc880_multi_pin_idx(nid); |
| 5115 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5116 | AC_VERB_SET_CONNECT_SEL, |
| 5117 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5118 | } |
| 5119 | } |
| 5120 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5121 | static int get_pin_type(int line_out_type) |
| 5122 | { |
| 5123 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5124 | return PIN_HP; |
| 5125 | else |
| 5126 | return PIN_OUT; |
| 5127 | } |
| 5128 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5129 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5130 | { |
| 5131 | struct alc_spec *spec = codec->spec; |
| 5132 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5133 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5134 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5135 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5136 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5137 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5138 | } |
| 5139 | } |
| 5140 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5141 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5142 | { |
| 5143 | struct alc_spec *spec = codec->spec; |
| 5144 | hda_nid_t pin; |
| 5145 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5146 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5147 | if (pin) /* connect to front */ |
| 5148 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5149 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5150 | if (pin) /* connect to front */ |
| 5151 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5152 | } |
| 5153 | |
| 5154 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5155 | { |
| 5156 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5157 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5158 | int i; |
| 5159 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5160 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5161 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5162 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame^] | 5163 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5164 | if (nid != ALC880_PIN_CD_NID && |
| 5165 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5166 | snd_hda_codec_write(codec, nid, 0, |
| 5167 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5168 | AMP_OUT_MUTE); |
| 5169 | } |
| 5170 | } |
| 5171 | } |
| 5172 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5173 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5174 | { |
| 5175 | struct alc_spec *spec = codec->spec; |
| 5176 | int c; |
| 5177 | |
| 5178 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5179 | unsigned int mux_idx; |
| 5180 | const struct hda_input_mux *imux; |
| 5181 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5182 | imux = &spec->input_mux[mux_idx]; |
| 5183 | if (!imux->num_items && mux_idx > 0) |
| 5184 | imux = &spec->input_mux[0]; |
| 5185 | if (imux) |
| 5186 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5187 | AC_VERB_SET_CONNECT_SEL, |
| 5188 | imux->items[0].index); |
| 5189 | } |
| 5190 | } |
| 5191 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5192 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5193 | /* return 1 if successful, 0 if the proper config is not found, |
| 5194 | * or a negative error code |
| 5195 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5196 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5197 | { |
| 5198 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5199 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5200 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5201 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5202 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5203 | alc880_ignore); |
| 5204 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5205 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5206 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5207 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5208 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5209 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5210 | if (err < 0) |
| 5211 | return err; |
| 5212 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5213 | if (err < 0) |
| 5214 | return err; |
| 5215 | err = alc880_auto_create_extra_out(spec, |
| 5216 | spec->autocfg.speaker_pins[0], |
| 5217 | "Speaker"); |
| 5218 | if (err < 0) |
| 5219 | return err; |
| 5220 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5221 | "Headphone"); |
| 5222 | if (err < 0) |
| 5223 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5224 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5225 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5226 | return err; |
| 5227 | |
| 5228 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5229 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5230 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5231 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5232 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5233 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5234 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5235 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5236 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5237 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5238 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5239 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5240 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5241 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5242 | return 1; |
| 5243 | } |
| 5244 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5245 | /* additional initialization for auto-configuration model */ |
| 5246 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5247 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5248 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5249 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5250 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5251 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5252 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5253 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5254 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5255 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5256 | } |
| 5257 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5258 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5259 | * one of two digital mic pins, e.g. on ALC272 |
| 5260 | */ |
| 5261 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5262 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5263 | struct alc_spec *spec = codec->spec; |
| 5264 | int i; |
| 5265 | |
| 5266 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5267 | hda_nid_t cap = spec->capsrc_nids ? |
| 5268 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5269 | int iidx, eidx; |
| 5270 | |
| 5271 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5272 | if (iidx < 0) |
| 5273 | continue; |
| 5274 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5275 | if (eidx < 0) |
| 5276 | continue; |
| 5277 | spec->int_mic.mux_idx = iidx; |
| 5278 | spec->ext_mic.mux_idx = eidx; |
| 5279 | if (spec->capsrc_nids) |
| 5280 | spec->capsrc_nids += i; |
| 5281 | spec->adc_nids += i; |
| 5282 | spec->num_adc_nids = 1; |
| 5283 | return; |
| 5284 | } |
| 5285 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5286 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5287 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5288 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5289 | } |
| 5290 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5291 | /* select or unmute the given capsrc route */ |
| 5292 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5293 | int idx) |
| 5294 | { |
| 5295 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5296 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5297 | HDA_AMP_MUTE, 0); |
| 5298 | } else { |
| 5299 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5300 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5301 | } |
| 5302 | } |
| 5303 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5304 | /* set the default connection to that pin */ |
| 5305 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5306 | { |
| 5307 | struct alc_spec *spec = codec->spec; |
| 5308 | int i; |
| 5309 | |
| 5310 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5311 | hda_nid_t cap = spec->capsrc_nids ? |
| 5312 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5313 | int idx; |
| 5314 | |
| 5315 | idx = get_connection_index(codec, cap, pin); |
| 5316 | if (idx < 0) |
| 5317 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5318 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5319 | return i; /* return the found index */ |
| 5320 | } |
| 5321 | return -1; /* not found */ |
| 5322 | } |
| 5323 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5324 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5325 | static void fixup_single_adc(struct hda_codec *codec) |
| 5326 | { |
| 5327 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5328 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5329 | int i; |
| 5330 | |
| 5331 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5332 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5333 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5334 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5335 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5336 | /* use only this ADC */ |
| 5337 | if (spec->capsrc_nids) |
| 5338 | spec->capsrc_nids += i; |
| 5339 | spec->adc_nids += i; |
| 5340 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5341 | } |
| 5342 | } |
| 5343 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5344 | /* initialize dual adcs */ |
| 5345 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5346 | { |
| 5347 | struct alc_spec *spec = codec->spec; |
| 5348 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5349 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5350 | } |
| 5351 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5352 | static void set_capture_mixer(struct hda_codec *codec) |
| 5353 | { |
| 5354 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5355 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5356 | { alc_capture_mixer_nosrc1, |
| 5357 | alc_capture_mixer_nosrc2, |
| 5358 | alc_capture_mixer_nosrc3 }, |
| 5359 | { alc_capture_mixer1, |
| 5360 | alc_capture_mixer2, |
| 5361 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5362 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5363 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5364 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5365 | int num_adcs = spec->num_adc_nids; |
| 5366 | if (spec->dual_adc_switch) |
| 5367 | fixup_dual_adc_switch(codec); |
| 5368 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5369 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5370 | else if (spec->input_mux) { |
| 5371 | if (spec->input_mux->num_items > 1) |
| 5372 | mux = 1; |
| 5373 | else if (spec->input_mux->num_items == 1) |
| 5374 | fixup_single_adc(codec); |
| 5375 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5376 | if (spec->dual_adc_switch) |
| 5377 | num_adcs = 1; |
| 5378 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5379 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5380 | } |
| 5381 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5382 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5383 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5384 | int num_nids) |
| 5385 | { |
| 5386 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5387 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5388 | int n; |
| 5389 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5390 | |
| 5391 | for (n = 0; n < num_nids; n++) { |
| 5392 | hda_nid_t adc, cap; |
| 5393 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5394 | int nconns, i, j; |
| 5395 | |
| 5396 | adc = nids[n]; |
| 5397 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5398 | continue; |
| 5399 | cap = adc; |
| 5400 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5401 | ARRAY_SIZE(conn)); |
| 5402 | if (nconns == 1) { |
| 5403 | cap = conn[0]; |
| 5404 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5405 | ARRAY_SIZE(conn)); |
| 5406 | } |
| 5407 | if (nconns <= 0) |
| 5408 | continue; |
| 5409 | if (!fallback_adc) { |
| 5410 | fallback_adc = adc; |
| 5411 | fallback_cap = cap; |
| 5412 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5413 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5414 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5415 | for (j = 0; j < nconns; j++) { |
| 5416 | if (conn[j] == nid) |
| 5417 | break; |
| 5418 | } |
| 5419 | if (j >= nconns) |
| 5420 | break; |
| 5421 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5422 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5423 | int num_adcs = spec->num_adc_nids; |
| 5424 | spec->private_adc_nids[num_adcs] = adc; |
| 5425 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5426 | spec->num_adc_nids++; |
| 5427 | spec->adc_nids = spec->private_adc_nids; |
| 5428 | if (adc != cap) |
| 5429 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5430 | } |
| 5431 | } |
| 5432 | if (!spec->num_adc_nids) { |
| 5433 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5434 | " using fallback 0x%x\n", |
| 5435 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5436 | spec->private_adc_nids[0] = fallback_adc; |
| 5437 | spec->adc_nids = spec->private_adc_nids; |
| 5438 | if (fallback_adc != fallback_cap) { |
| 5439 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5440 | spec->capsrc_nids = spec->private_adc_nids; |
| 5441 | } |
| 5442 | } |
| 5443 | } |
| 5444 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5445 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5446 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5447 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5448 | |
| 5449 | static struct snd_pci_quirk beep_white_list[] = { |
| 5450 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5451 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5452 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5453 | {} |
| 5454 | }; |
| 5455 | |
| 5456 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5457 | { |
| 5458 | struct alc_spec *spec = codec->spec; |
| 5459 | const struct snd_pci_quirk *q; |
| 5460 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5461 | if (q) |
| 5462 | return q->value; |
| 5463 | return spec->cdefine.enable_pcbeep; |
| 5464 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5465 | #else |
| 5466 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5467 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5468 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5469 | |
| 5470 | /* |
| 5471 | * OK, here we have finally the patch for ALC880 |
| 5472 | */ |
| 5473 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5474 | static int patch_alc880(struct hda_codec *codec) |
| 5475 | { |
| 5476 | struct alc_spec *spec; |
| 5477 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5478 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5479 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5480 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5481 | if (spec == NULL) |
| 5482 | return -ENOMEM; |
| 5483 | |
| 5484 | codec->spec = spec; |
| 5485 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5486 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5487 | alc880_models, |
| 5488 | alc880_cfg_tbl); |
| 5489 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5490 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5491 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5492 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5493 | } |
| 5494 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5495 | if (board_config == ALC880_AUTO) { |
| 5496 | /* automatic parse from the BIOS config */ |
| 5497 | err = alc880_parse_auto_config(codec); |
| 5498 | if (err < 0) { |
| 5499 | alc_free(codec); |
| 5500 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5501 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5502 | printk(KERN_INFO |
| 5503 | "hda_codec: Cannot set up configuration " |
| 5504 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5505 | board_config = ALC880_3ST; |
| 5506 | } |
| 5507 | } |
| 5508 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5509 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5510 | if (err < 0) { |
| 5511 | alc_free(codec); |
| 5512 | return err; |
| 5513 | } |
| 5514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5515 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5516 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5517 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5518 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5519 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5520 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5521 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5522 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5523 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5524 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5525 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5526 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5527 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5528 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5529 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5530 | if (wcap != AC_WID_AUD_IN) { |
| 5531 | spec->adc_nids = alc880_adc_nids_alt; |
| 5532 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5533 | } else { |
| 5534 | spec->adc_nids = alc880_adc_nids; |
| 5535 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5536 | } |
| 5537 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5538 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5539 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5540 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5541 | spec->vmaster_nid = 0x0c; |
| 5542 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5543 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5544 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5545 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5546 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5547 | if (!spec->loopback.amplist) |
| 5548 | spec->loopback.amplist = alc880_loopbacks; |
| 5549 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5550 | |
| 5551 | return 0; |
| 5552 | } |
| 5553 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5554 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5555 | /* |
| 5556 | * ALC260 support |
| 5557 | */ |
| 5558 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5559 | static hda_nid_t alc260_dac_nids[1] = { |
| 5560 | /* front */ |
| 5561 | 0x02, |
| 5562 | }; |
| 5563 | |
| 5564 | static hda_nid_t alc260_adc_nids[1] = { |
| 5565 | /* ADC0 */ |
| 5566 | 0x04, |
| 5567 | }; |
| 5568 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5569 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5570 | /* ADC1 */ |
| 5571 | 0x05, |
| 5572 | }; |
| 5573 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5574 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5575 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5576 | */ |
| 5577 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5578 | /* ADC0, ADC1 */ |
| 5579 | 0x04, 0x05 |
| 5580 | }; |
| 5581 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5582 | #define ALC260_DIGOUT_NID 0x03 |
| 5583 | #define ALC260_DIGIN_NID 0x06 |
| 5584 | |
| 5585 | static struct hda_input_mux alc260_capture_source = { |
| 5586 | .num_items = 4, |
| 5587 | .items = { |
| 5588 | { "Mic", 0x0 }, |
| 5589 | { "Front Mic", 0x1 }, |
| 5590 | { "Line", 0x2 }, |
| 5591 | { "CD", 0x4 }, |
| 5592 | }, |
| 5593 | }; |
| 5594 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5595 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5596 | * headphone jack and the internal CD lines since these are the only pins at |
| 5597 | * which audio can appear. For flexibility, also allow the option of |
| 5598 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5599 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5600 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5601 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5602 | { |
| 5603 | .num_items = 3, |
| 5604 | .items = { |
| 5605 | { "Mic/Line", 0x0 }, |
| 5606 | { "CD", 0x4 }, |
| 5607 | { "Headphone", 0x2 }, |
| 5608 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5609 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5610 | { |
| 5611 | .num_items = 4, |
| 5612 | .items = { |
| 5613 | { "Mic/Line", 0x0 }, |
| 5614 | { "CD", 0x4 }, |
| 5615 | { "Headphone", 0x2 }, |
| 5616 | { "Mixer", 0x5 }, |
| 5617 | }, |
| 5618 | }, |
| 5619 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5620 | }; |
| 5621 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5622 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5623 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5624 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5625 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5626 | { |
| 5627 | .num_items = 4, |
| 5628 | .items = { |
| 5629 | { "Mic", 0x0 }, |
| 5630 | { "Line", 0x2 }, |
| 5631 | { "CD", 0x4 }, |
| 5632 | { "Headphone", 0x5 }, |
| 5633 | }, |
| 5634 | }, |
| 5635 | { |
| 5636 | .num_items = 5, |
| 5637 | .items = { |
| 5638 | { "Mic", 0x0 }, |
| 5639 | { "Line", 0x2 }, |
| 5640 | { "CD", 0x4 }, |
| 5641 | { "Headphone", 0x6 }, |
| 5642 | { "Mixer", 0x5 }, |
| 5643 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5644 | }, |
| 5645 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5646 | |
| 5647 | /* Maxdata Favorit 100XS */ |
| 5648 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5649 | { |
| 5650 | .num_items = 2, |
| 5651 | .items = { |
| 5652 | { "Line/Mic", 0x0 }, |
| 5653 | { "CD", 0x4 }, |
| 5654 | }, |
| 5655 | }, |
| 5656 | { |
| 5657 | .num_items = 3, |
| 5658 | .items = { |
| 5659 | { "Line/Mic", 0x0 }, |
| 5660 | { "CD", 0x4 }, |
| 5661 | { "Mixer", 0x5 }, |
| 5662 | }, |
| 5663 | }, |
| 5664 | }; |
| 5665 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5666 | /* |
| 5667 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5668 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5669 | * element which allows changing the channel mode, so the verb list is |
| 5670 | * never used. |
| 5671 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5672 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5673 | { 2, NULL }, |
| 5674 | }; |
| 5675 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5676 | |
| 5677 | /* Mixer combinations |
| 5678 | * |
| 5679 | * basic: base_output + input + pc_beep + capture |
| 5680 | * HP: base_output + input + capture_alt |
| 5681 | * HP_3013: hp_3013 + input + capture |
| 5682 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5683 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5684 | */ |
| 5685 | |
| 5686 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5687 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5688 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5689 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5690 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5691 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5692 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5693 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5694 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5695 | |
| 5696 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5697 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5698 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5699 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5700 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5701 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5702 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5703 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5704 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5705 | { } /* end */ |
| 5706 | }; |
| 5707 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5708 | /* update HP, line and mono out pins according to the master switch */ |
| 5709 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5710 | hda_nid_t hp, hda_nid_t line, |
| 5711 | hda_nid_t mono) |
| 5712 | { |
| 5713 | struct alc_spec *spec = codec->spec; |
| 5714 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5715 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5716 | 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] | 5717 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5718 | 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] | 5719 | val); |
| 5720 | /* mono (speaker) depending on the HP jack sense */ |
| 5721 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5722 | 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] | 5723 | val); |
| 5724 | } |
| 5725 | |
| 5726 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5727 | struct snd_ctl_elem_value *ucontrol) |
| 5728 | { |
| 5729 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5730 | struct alc_spec *spec = codec->spec; |
| 5731 | *ucontrol->value.integer.value = spec->master_sw; |
| 5732 | return 0; |
| 5733 | } |
| 5734 | |
| 5735 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5736 | struct snd_ctl_elem_value *ucontrol) |
| 5737 | { |
| 5738 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5739 | struct alc_spec *spec = codec->spec; |
| 5740 | int val = !!*ucontrol->value.integer.value; |
| 5741 | hda_nid_t hp, line, mono; |
| 5742 | |
| 5743 | if (val == spec->master_sw) |
| 5744 | return 0; |
| 5745 | spec->master_sw = val; |
| 5746 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5747 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5748 | mono = kcontrol->private_value & 0xff; |
| 5749 | alc260_hp_master_update(codec, hp, line, mono); |
| 5750 | return 1; |
| 5751 | } |
| 5752 | |
| 5753 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5754 | { |
| 5755 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5756 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5757 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5758 | .info = snd_ctl_boolean_mono_info, |
| 5759 | .get = alc260_hp_master_sw_get, |
| 5760 | .put = alc260_hp_master_sw_put, |
| 5761 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5762 | }, |
| 5763 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5764 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5765 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5766 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5767 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5768 | HDA_OUTPUT), |
| 5769 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5770 | { } /* end */ |
| 5771 | }; |
| 5772 | |
| 5773 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5774 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5775 | {}, |
| 5776 | }; |
| 5777 | |
| 5778 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5779 | { |
| 5780 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5781 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5782 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5783 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5784 | } |
| 5785 | |
| 5786 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5787 | { |
| 5788 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5789 | alc260_hp_automute(codec); |
| 5790 | } |
| 5791 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5792 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5793 | { |
| 5794 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5795 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5796 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5797 | .info = snd_ctl_boolean_mono_info, |
| 5798 | .get = alc260_hp_master_sw_get, |
| 5799 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5800 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5801 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5802 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5803 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5804 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5805 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5806 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5807 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5808 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5809 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5810 | { } /* end */ |
| 5811 | }; |
| 5812 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5813 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5814 | .ops = &snd_hda_bind_vol, |
| 5815 | .values = { |
| 5816 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5817 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5818 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5819 | 0 |
| 5820 | }, |
| 5821 | }; |
| 5822 | |
| 5823 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5824 | .ops = &snd_hda_bind_sw, |
| 5825 | .values = { |
| 5826 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5827 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5828 | 0 |
| 5829 | }, |
| 5830 | }; |
| 5831 | |
| 5832 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5833 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5834 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5835 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5837 | { } /* end */ |
| 5838 | }; |
| 5839 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5840 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5841 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5842 | {}, |
| 5843 | }; |
| 5844 | |
| 5845 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5846 | { |
| 5847 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5848 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5849 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5850 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5851 | } |
| 5852 | |
| 5853 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5854 | unsigned int res) |
| 5855 | { |
| 5856 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5857 | alc260_hp_3013_automute(codec); |
| 5858 | } |
| 5859 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5860 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5861 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5862 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5863 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5864 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5865 | bits); |
| 5866 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5867 | bits); |
| 5868 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5869 | bits); |
| 5870 | } |
| 5871 | |
| 5872 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5873 | unsigned int res) |
| 5874 | { |
| 5875 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5876 | alc260_hp_3012_automute(codec); |
| 5877 | } |
| 5878 | |
| 5879 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5880 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5881 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5882 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5883 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5884 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5885 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5886 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5887 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5888 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5889 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5890 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5891 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5892 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5893 | { } /* end */ |
| 5894 | }; |
| 5895 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5896 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5897 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5898 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5899 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5900 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5901 | * revisions available in early 2006. Therefore for now allow the |
| 5902 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5903 | * that the lack of mic bias for this NID is intentional we could change the |
| 5904 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5905 | * |
| 5906 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5907 | * don't appear to make the mic bias available from the "line" jack, even |
| 5908 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5909 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5910 | * and the output jack. If this turns out to be the case for all such |
| 5911 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5912 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5913 | * |
| 5914 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5915 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5916 | * controls for such models. On models without a "mono speaker" the control |
| 5917 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5918 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5919 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5920 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5921 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5922 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5923 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5924 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5925 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5926 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5927 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5928 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5931 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5932 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5933 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5934 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5935 | { } /* end */ |
| 5936 | }; |
| 5937 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5938 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5939 | */ |
| 5940 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5941 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5942 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5943 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5944 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5945 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5946 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5947 | { } /* end */ |
| 5948 | }; |
| 5949 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5950 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5951 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5952 | */ |
| 5953 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5954 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5955 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5957 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5958 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5959 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5960 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5961 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5962 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5963 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5964 | { } /* end */ |
| 5965 | }; |
| 5966 | |
| 5967 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5968 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5969 | */ |
| 5970 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5971 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5972 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5974 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5975 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5976 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5977 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5978 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5979 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5980 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5981 | { } /* end */ |
| 5982 | }; |
| 5983 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5984 | /* |
| 5985 | * initialization verbs |
| 5986 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5987 | static struct hda_verb alc260_init_verbs[] = { |
| 5988 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5989 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5990 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5991 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5992 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5993 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5994 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5995 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5996 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5997 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5998 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5999 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6000 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6001 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6002 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6003 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6004 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6005 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6006 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6007 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6008 | /* set connection select to line in (default select for this ADC) */ |
| 6009 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6010 | /* mute capture amp left and right */ |
| 6011 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6012 | /* set connection select to line in (default select for this ADC) */ |
| 6013 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6014 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6015 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6016 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6017 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6018 | /* set vol=0 HP mixer amp left and right */ |
| 6019 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6020 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6021 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6022 | /* set vol=0 Mono mixer amp left and right */ |
| 6023 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6024 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6025 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6026 | /* unmute LINE-2 out pin */ |
| 6027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6028 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6029 | * Line In 2 = 0x03 |
| 6030 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6031 | /* mute analog inputs */ |
| 6032 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6033 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6034 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6035 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6036 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6037 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6038 | /* mute Front out path */ |
| 6039 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6040 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6041 | /* mute Headphone out path */ |
| 6042 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6043 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6044 | /* mute Mono out path */ |
| 6045 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6046 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6047 | { } |
| 6048 | }; |
| 6049 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6050 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6051 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6052 | /* Headphone and output */ |
| 6053 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6054 | /* mono output */ |
| 6055 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6056 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6057 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6058 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6059 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6060 | /* Line In pin widget for input */ |
| 6061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6062 | /* Line-2 pin widget for output */ |
| 6063 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6064 | /* CD pin widget for input */ |
| 6065 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6066 | /* unmute amp left and right */ |
| 6067 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6068 | /* set connection select to line in (default select for this ADC) */ |
| 6069 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6070 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6071 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6072 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6073 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6074 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6075 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6076 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6077 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6078 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6079 | * Line In 2 = 0x03 |
| 6080 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6081 | /* mute analog inputs */ |
| 6082 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6084 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6085 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6086 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6087 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6088 | /* Unmute Front out path */ |
| 6089 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6090 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6091 | /* Unmute Headphone out path */ |
| 6092 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6093 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6094 | /* Unmute Mono out path */ |
| 6095 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6096 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6097 | { } |
| 6098 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6099 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6100 | |
| 6101 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6102 | /* Line out and output */ |
| 6103 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6104 | /* mono output */ |
| 6105 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6106 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6107 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6108 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6109 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6110 | /* Line In pin widget for input */ |
| 6111 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6112 | /* Headphone pin widget for output */ |
| 6113 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6114 | /* CD pin widget for input */ |
| 6115 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6116 | /* unmute amp left and right */ |
| 6117 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6118 | /* set connection select to line in (default select for this ADC) */ |
| 6119 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6120 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6122 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6123 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6124 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6126 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6127 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6128 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6129 | * Line In 2 = 0x03 |
| 6130 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6131 | /* mute analog inputs */ |
| 6132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6134 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6135 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6136 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6137 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6138 | /* Unmute Front out path */ |
| 6139 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6140 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6141 | /* Unmute Headphone out path */ |
| 6142 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6143 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6144 | /* Unmute Mono out path */ |
| 6145 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6146 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6147 | { } |
| 6148 | }; |
| 6149 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6150 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6151 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6152 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6153 | */ |
| 6154 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6155 | /* Disable all GPIOs */ |
| 6156 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6157 | /* Internal speaker is connected to headphone pin */ |
| 6158 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6159 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6160 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6161 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6162 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6163 | /* Ensure all other unused pins are disabled and muted. */ |
| 6164 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6165 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6166 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6167 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6168 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6169 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6170 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6171 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6172 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6173 | /* Disable digital (SPDIF) pins */ |
| 6174 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6175 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6176 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6177 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6178 | * when acting as an output. |
| 6179 | */ |
| 6180 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6181 | |
| 6182 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6183 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6184 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6185 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6186 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6187 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6188 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6189 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6190 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6191 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6192 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6193 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6194 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6195 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6196 | * If the pin mode is changed by the user the pin mode control will |
| 6197 | * take care of enabling the pin's input/output buffers as needed. |
| 6198 | * Therefore there's no need to enable the input buffer at this |
| 6199 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6200 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6201 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6202 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6203 | * mixer ctrl) |
| 6204 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6205 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6206 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6207 | /* Mute capture amp left and right */ |
| 6208 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6209 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6210 | * in (on mic1 pin) |
| 6211 | */ |
| 6212 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6213 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6214 | /* Do the same for the second ADC: mute capture input amp and |
| 6215 | * set ADC connection to line in (on mic1 pin) |
| 6216 | */ |
| 6217 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6218 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6219 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6220 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6221 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6222 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6223 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6224 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6225 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6226 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6228 | {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] | 6229 | |
| 6230 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6231 | }; |
| 6232 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6233 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6234 | * similar laptops (adapted from Fujitsu init verbs). |
| 6235 | */ |
| 6236 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6237 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6238 | * the headphone jack. Turn this on and rely on the standard mute |
| 6239 | * methods whenever the user wants to turn these outputs off. |
| 6240 | */ |
| 6241 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6242 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6243 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6244 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6245 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6246 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6247 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6248 | /* Line In jack is connected to Line1 pin */ |
| 6249 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6250 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6251 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6252 | /* Ensure all other unused pins are disabled and muted. */ |
| 6253 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6254 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6255 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6256 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6257 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6258 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6259 | /* Disable digital (SPDIF) pins */ |
| 6260 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6261 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6262 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6263 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6264 | * bus when acting as outputs. |
| 6265 | */ |
| 6266 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6267 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6268 | |
| 6269 | /* Start with output sum widgets muted and their output gains at min */ |
| 6270 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6271 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6272 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6273 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6274 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6275 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6276 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6277 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6278 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6279 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6280 | /* Unmute Line-out pin widget amp left and right |
| 6281 | * (no equiv mixer ctrl) |
| 6282 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6283 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6284 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6285 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6286 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6287 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6288 | * will take care of enabling the pin's input/output buffers as needed. |
| 6289 | * Therefore there's no need to enable the input buffer at this |
| 6290 | * stage. |
| 6291 | */ |
| 6292 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6293 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6294 | |
| 6295 | /* Mute capture amp left and right */ |
| 6296 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6297 | /* Set ADC connection select to match default mixer setting - mic |
| 6298 | * (on mic1 pin) |
| 6299 | */ |
| 6300 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6301 | |
| 6302 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6303 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6304 | */ |
| 6305 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6306 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6307 | |
| 6308 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6309 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6312 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6313 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6314 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6315 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6316 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6317 | |
| 6318 | { } |
| 6319 | }; |
| 6320 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6321 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6322 | * (adapted from Acer init verbs). |
| 6323 | */ |
| 6324 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6325 | /* GPIO 0 enables the output jack. |
| 6326 | * Turn this on and rely on the standard mute |
| 6327 | * methods whenever the user wants to turn these outputs off. |
| 6328 | */ |
| 6329 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6330 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6331 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6332 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6333 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6334 | /* Ensure all other unused pins are disabled and muted. */ |
| 6335 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6336 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6337 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6338 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6339 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6340 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6341 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6342 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6343 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6344 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6345 | /* Disable digital (SPDIF) pins */ |
| 6346 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6347 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6348 | |
| 6349 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6350 | * bus when acting as outputs. |
| 6351 | */ |
| 6352 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6353 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6354 | |
| 6355 | /* Start with output sum widgets muted and their output gains at min */ |
| 6356 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6357 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6358 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6359 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6360 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6361 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6362 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6363 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6364 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6365 | |
| 6366 | /* Unmute Line-out pin widget amp left and right |
| 6367 | * (no equiv mixer ctrl) |
| 6368 | */ |
| 6369 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6370 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6371 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6372 | * will take care of enabling the pin's input/output buffers as needed. |
| 6373 | * Therefore there's no need to enable the input buffer at this |
| 6374 | * stage. |
| 6375 | */ |
| 6376 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6377 | |
| 6378 | /* Mute capture amp left and right */ |
| 6379 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6380 | /* Set ADC connection select to match default mixer setting - mic |
| 6381 | * (on mic1 pin) |
| 6382 | */ |
| 6383 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6384 | |
| 6385 | /* Do similar with the second ADC: mute capture input amp and |
| 6386 | * set ADC connection to mic to match ALSA's default state. |
| 6387 | */ |
| 6388 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6389 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6390 | |
| 6391 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6392 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6393 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6394 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6395 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6400 | |
| 6401 | { } |
| 6402 | }; |
| 6403 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6404 | static struct hda_verb alc260_will_verbs[] = { |
| 6405 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6406 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6407 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6408 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6409 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6410 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6411 | {} |
| 6412 | }; |
| 6413 | |
| 6414 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6415 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6416 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6417 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6418 | |
| 6419 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6420 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6421 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6422 | |
| 6423 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6424 | {} |
| 6425 | }; |
| 6426 | |
| 6427 | /* toggle speaker-output according to the hp-jack state */ |
| 6428 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6429 | { |
| 6430 | unsigned int present; |
| 6431 | |
| 6432 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6433 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6434 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6435 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6436 | AC_VERB_SET_GPIO_DATA, 1); |
| 6437 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6438 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6439 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6440 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6441 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6442 | AC_VERB_SET_GPIO_DATA, 0); |
| 6443 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6444 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6445 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6446 | } |
| 6447 | } |
| 6448 | |
| 6449 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6450 | unsigned int res) |
| 6451 | { |
| 6452 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6453 | alc260_replacer_672v_automute(codec); |
| 6454 | } |
| 6455 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6456 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6457 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6458 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6459 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6460 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6461 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6462 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6463 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6464 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6465 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6466 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6467 | {} |
| 6468 | }; |
| 6469 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6470 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6471 | * configuration. |
| 6472 | */ |
| 6473 | #ifdef CONFIG_SND_DEBUG |
| 6474 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6475 | 0x02, |
| 6476 | }; |
| 6477 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6478 | 0x04, 0x05, |
| 6479 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6480 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6481 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6482 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6483 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6484 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6485 | { |
| 6486 | .num_items = 7, |
| 6487 | .items = { |
| 6488 | { "MIC1 pin", 0x0 }, |
| 6489 | { "MIC2 pin", 0x1 }, |
| 6490 | { "LINE1 pin", 0x2 }, |
| 6491 | { "LINE2 pin", 0x3 }, |
| 6492 | { "CD pin", 0x4 }, |
| 6493 | { "LINE-OUT pin", 0x5 }, |
| 6494 | { "HP-OUT pin", 0x6 }, |
| 6495 | }, |
| 6496 | }, |
| 6497 | { |
| 6498 | .num_items = 8, |
| 6499 | .items = { |
| 6500 | { "MIC1 pin", 0x0 }, |
| 6501 | { "MIC2 pin", 0x1 }, |
| 6502 | { "LINE1 pin", 0x2 }, |
| 6503 | { "LINE2 pin", 0x3 }, |
| 6504 | { "CD pin", 0x4 }, |
| 6505 | { "Mixer", 0x5 }, |
| 6506 | { "LINE-OUT pin", 0x6 }, |
| 6507 | { "HP-OUT pin", 0x7 }, |
| 6508 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6509 | }, |
| 6510 | }; |
| 6511 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6512 | /* Output driver widgets */ |
| 6513 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6514 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6515 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6516 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6517 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6518 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6519 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6520 | /* Modes for retasking pin widgets |
| 6521 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6522 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6523 | * mention this restriction. At this stage it's not clear whether |
| 6524 | * this behaviour is intentional or is a hardware bug in chip |
| 6525 | * revisions available at least up until early 2006. Therefore for |
| 6526 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6527 | * choices, but if it turns out that the lack of mic bias for these |
| 6528 | * NIDs is intentional we could change their modes from |
| 6529 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6530 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6531 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6532 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6533 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6534 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6535 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6536 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6537 | |
| 6538 | /* Loopback mixer controls */ |
| 6539 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6540 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6541 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6542 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6543 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6544 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6545 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6546 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6547 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6548 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6549 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6550 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6551 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6552 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6553 | |
| 6554 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6555 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6556 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6557 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6558 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6559 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6560 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6561 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6562 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6563 | */ |
| 6564 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6565 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6566 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6567 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6568 | * this output to turn on an external amplifier. |
| 6569 | */ |
| 6570 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6571 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6572 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6573 | { } /* end */ |
| 6574 | }; |
| 6575 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6576 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6577 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6578 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6579 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6580 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6581 | /* Enable retasking pins as output, initially without power amp */ |
| 6582 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6583 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6585 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6586 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6587 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6588 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6589 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6590 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6591 | * payload also sets the generation to 0, output to be in "consumer" |
| 6592 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6593 | * control. |
| 6594 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6595 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6596 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6597 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6598 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6599 | * OUT1 sum bus when acting as an output. |
| 6600 | */ |
| 6601 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6602 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6603 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6604 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6605 | |
| 6606 | /* Start with output sum widgets muted and their output gains at min */ |
| 6607 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6608 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6609 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6610 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6611 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6612 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6613 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6614 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6615 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6616 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6617 | /* Unmute retasking pin widget output buffers since the default |
| 6618 | * state appears to be output. As the pin mode is changed by the |
| 6619 | * user the pin mode control will take care of enabling the pin's |
| 6620 | * input/output buffers as needed. |
| 6621 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6622 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6623 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6625 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6626 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6627 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6628 | /* Also unmute the mono-out pin widget */ |
| 6629 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6630 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6631 | /* Mute capture amp left and right */ |
| 6632 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6633 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6634 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6635 | */ |
| 6636 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6637 | |
| 6638 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6639 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6640 | */ |
| 6641 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6642 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6643 | |
| 6644 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6646 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6650 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6651 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6652 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6653 | |
| 6654 | { } |
| 6655 | }; |
| 6656 | #endif |
| 6657 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6658 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6659 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6660 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6661 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6662 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6663 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6664 | /* |
| 6665 | * for BIOS auto-configuration |
| 6666 | */ |
| 6667 | |
| 6668 | 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] | 6669 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6670 | { |
| 6671 | hda_nid_t nid_vol; |
| 6672 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6673 | int err; |
| 6674 | |
| 6675 | if (nid >= 0x0f && nid < 0x11) { |
| 6676 | nid_vol = nid - 0x7; |
| 6677 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6678 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6679 | } else if (nid == 0x11) { |
| 6680 | nid_vol = nid - 0x7; |
| 6681 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6682 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6683 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6684 | nid_vol = 0x08; |
| 6685 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6686 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6687 | } else |
| 6688 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6689 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6690 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6691 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6692 | 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] | 6693 | if (err < 0) |
| 6694 | return err; |
| 6695 | *vol_bits |= (1 << nid_vol); |
| 6696 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6697 | 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] | 6698 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6699 | return err; |
| 6700 | return 1; |
| 6701 | } |
| 6702 | |
| 6703 | /* add playback controls from the parsed DAC table */ |
| 6704 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6705 | const struct auto_pin_cfg *cfg) |
| 6706 | { |
| 6707 | hda_nid_t nid; |
| 6708 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6709 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6710 | |
| 6711 | spec->multiout.num_dacs = 1; |
| 6712 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6713 | spec->multiout.dac_nids[0] = 0x02; |
| 6714 | |
| 6715 | nid = cfg->line_out_pins[0]; |
| 6716 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6717 | const char *pfx; |
| 6718 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6719 | pfx = "Master"; |
| 6720 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6721 | pfx = "Speaker"; |
| 6722 | else |
| 6723 | pfx = "Front"; |
| 6724 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6725 | if (err < 0) |
| 6726 | return err; |
| 6727 | } |
| 6728 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6729 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6730 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6731 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6732 | if (err < 0) |
| 6733 | return err; |
| 6734 | } |
| 6735 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6736 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6737 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6738 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6739 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6740 | if (err < 0) |
| 6741 | return err; |
| 6742 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6743 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6744 | } |
| 6745 | |
| 6746 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6747 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6748 | const struct auto_pin_cfg *cfg) |
| 6749 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6750 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6751 | } |
| 6752 | |
| 6753 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6754 | hda_nid_t nid, int pin_type, |
| 6755 | int sel_idx) |
| 6756 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6757 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6758 | /* need the manual connection? */ |
| 6759 | if (nid >= 0x12) { |
| 6760 | int idx = nid - 0x12; |
| 6761 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6762 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6763 | } |
| 6764 | } |
| 6765 | |
| 6766 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6767 | { |
| 6768 | struct alc_spec *spec = codec->spec; |
| 6769 | hda_nid_t nid; |
| 6770 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6771 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6772 | if (nid) { |
| 6773 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6774 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6775 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6776 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6777 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6778 | if (nid) |
| 6779 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6780 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6781 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6782 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6783 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6784 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6785 | |
| 6786 | #define ALC260_PIN_CD_NID 0x16 |
| 6787 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6788 | { |
| 6789 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6790 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6791 | int i; |
| 6792 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6793 | for (i = 0; i < cfg->num_inputs; i++) { |
| 6794 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6795 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame^] | 6796 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6797 | if (nid != ALC260_PIN_CD_NID && |
| 6798 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6799 | snd_hda_codec_write(codec, nid, 0, |
| 6800 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6801 | AMP_OUT_MUTE); |
| 6802 | } |
| 6803 | } |
| 6804 | } |
| 6805 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6806 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6807 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6808 | /* |
| 6809 | * generic initialization of ADC, input mixers and output mixers |
| 6810 | */ |
| 6811 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6812 | /* |
| 6813 | * Unmute ADC0-1 and set the default input to mic-in |
| 6814 | */ |
| 6815 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6816 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6817 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6818 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6819 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6820 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6821 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6822 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6823 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6824 | */ |
| 6825 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6826 | /* mute analog inputs */ |
| 6827 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6828 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6829 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6830 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6831 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6832 | |
| 6833 | /* |
| 6834 | * Set up output mixers (0x08 - 0x0a) |
| 6835 | */ |
| 6836 | /* set vol=0 to output mixers */ |
| 6837 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6838 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6839 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6840 | /* set up input amps for analog loopback */ |
| 6841 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6842 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6843 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6844 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6845 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6846 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6847 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6848 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6849 | { } |
| 6850 | }; |
| 6851 | |
| 6852 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6853 | { |
| 6854 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6855 | int err; |
| 6856 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6857 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6858 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6859 | alc260_ignore); |
| 6860 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6861 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6862 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6863 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6864 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6865 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6866 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6867 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6868 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6869 | return err; |
| 6870 | |
| 6871 | spec->multiout.max_channels = 2; |
| 6872 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6873 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6874 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6875 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6876 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6877 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6878 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6879 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6880 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6881 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6882 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6883 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6884 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6885 | return 1; |
| 6886 | } |
| 6887 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6888 | /* additional initialization for auto-configuration model */ |
| 6889 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6890 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6891 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6892 | alc260_auto_init_multi_out(codec); |
| 6893 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6894 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 6895 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6896 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6897 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6898 | } |
| 6899 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6900 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6901 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6902 | { 0x07, HDA_INPUT, 0 }, |
| 6903 | { 0x07, HDA_INPUT, 1 }, |
| 6904 | { 0x07, HDA_INPUT, 2 }, |
| 6905 | { 0x07, HDA_INPUT, 3 }, |
| 6906 | { 0x07, HDA_INPUT, 4 }, |
| 6907 | { } /* end */ |
| 6908 | }; |
| 6909 | #endif |
| 6910 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6911 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6912 | * Pin config fixes |
| 6913 | */ |
| 6914 | enum { |
| 6915 | PINFIX_HP_DC5750, |
| 6916 | }; |
| 6917 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6918 | static const struct alc_fixup alc260_fixups[] = { |
| 6919 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 6920 | .pins = (const struct alc_pincfg[]) { |
| 6921 | { 0x11, 0x90130110 }, /* speaker */ |
| 6922 | { } |
| 6923 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6924 | }, |
| 6925 | }; |
| 6926 | |
| 6927 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 6928 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 6929 | {} |
| 6930 | }; |
| 6931 | |
| 6932 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6933 | * ALC260 configurations |
| 6934 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6935 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6936 | [ALC260_BASIC] = "basic", |
| 6937 | [ALC260_HP] = "hp", |
| 6938 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6939 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6940 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6941 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6942 | [ALC260_WILL] = "will", |
| 6943 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6944 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6945 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6946 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6947 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6948 | [ALC260_AUTO] = "auto", |
| 6949 | }; |
| 6950 | |
| 6951 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6952 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6953 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6954 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6955 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6956 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6957 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6958 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6959 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6960 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6961 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6962 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6963 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6964 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6965 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6966 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6967 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6968 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6969 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6970 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6971 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6972 | {} |
| 6973 | }; |
| 6974 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6975 | static struct alc_config_preset alc260_presets[] = { |
| 6976 | [ALC260_BASIC] = { |
| 6977 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6978 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6979 | .init_verbs = { alc260_init_verbs }, |
| 6980 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6981 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6982 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6983 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6984 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6985 | .channel_mode = alc260_modes, |
| 6986 | .input_mux = &alc260_capture_source, |
| 6987 | }, |
| 6988 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6989 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6990 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6991 | .init_verbs = { alc260_init_verbs, |
| 6992 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6993 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6994 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6995 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6996 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6997 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6998 | .channel_mode = alc260_modes, |
| 6999 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7000 | .unsol_event = alc260_hp_unsol_event, |
| 7001 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7002 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7003 | [ALC260_HP_DC7600] = { |
| 7004 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7005 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7006 | .init_verbs = { alc260_init_verbs, |
| 7007 | alc260_hp_dc7600_verbs }, |
| 7008 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7009 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7010 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7011 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7012 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7013 | .channel_mode = alc260_modes, |
| 7014 | .input_mux = &alc260_capture_source, |
| 7015 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7016 | .init_hook = alc260_hp_3012_automute, |
| 7017 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7018 | [ALC260_HP_3013] = { |
| 7019 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7020 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7021 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7022 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7023 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7024 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7025 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7026 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7027 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7028 | .channel_mode = alc260_modes, |
| 7029 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7030 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7031 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7032 | }, |
| 7033 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7034 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7035 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7036 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7037 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7038 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7039 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7040 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7041 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7042 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7043 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7044 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7045 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7046 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7047 | .init_verbs = { alc260_acer_init_verbs }, |
| 7048 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7049 | .dac_nids = alc260_dac_nids, |
| 7050 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7051 | .adc_nids = alc260_dual_adc_nids, |
| 7052 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7053 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7054 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7055 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7056 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7057 | [ALC260_FAVORIT100] = { |
| 7058 | .mixers = { alc260_favorit100_mixer }, |
| 7059 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7060 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7061 | .dac_nids = alc260_dac_nids, |
| 7062 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7063 | .adc_nids = alc260_dual_adc_nids, |
| 7064 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7065 | .channel_mode = alc260_modes, |
| 7066 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7067 | .input_mux = alc260_favorit100_capture_sources, |
| 7068 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7069 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7070 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7071 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7072 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7073 | .dac_nids = alc260_dac_nids, |
| 7074 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7075 | .adc_nids = alc260_adc_nids, |
| 7076 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7077 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7078 | .channel_mode = alc260_modes, |
| 7079 | .input_mux = &alc260_capture_source, |
| 7080 | }, |
| 7081 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7082 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7083 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7084 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7085 | .dac_nids = alc260_dac_nids, |
| 7086 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7087 | .adc_nids = alc260_adc_nids, |
| 7088 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7089 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7090 | .channel_mode = alc260_modes, |
| 7091 | .input_mux = &alc260_capture_source, |
| 7092 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7093 | .init_hook = alc260_replacer_672v_automute, |
| 7094 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7095 | #ifdef CONFIG_SND_DEBUG |
| 7096 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7097 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7098 | .init_verbs = { alc260_test_init_verbs }, |
| 7099 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7100 | .dac_nids = alc260_test_dac_nids, |
| 7101 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7102 | .adc_nids = alc260_test_adc_nids, |
| 7103 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7104 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7105 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7106 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7107 | }, |
| 7108 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7109 | }; |
| 7110 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7111 | static int patch_alc260(struct hda_codec *codec) |
| 7112 | { |
| 7113 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7114 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7115 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7116 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7117 | if (spec == NULL) |
| 7118 | return -ENOMEM; |
| 7119 | |
| 7120 | codec->spec = spec; |
| 7121 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7122 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7123 | alc260_models, |
| 7124 | alc260_cfg_tbl); |
| 7125 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7126 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7127 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7128 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7129 | } |
| 7130 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7131 | if (board_config == ALC260_AUTO) |
| 7132 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); |
| 7133 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7134 | if (board_config == ALC260_AUTO) { |
| 7135 | /* automatic parse from the BIOS config */ |
| 7136 | err = alc260_parse_auto_config(codec); |
| 7137 | if (err < 0) { |
| 7138 | alc_free(codec); |
| 7139 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7140 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7141 | printk(KERN_INFO |
| 7142 | "hda_codec: Cannot set up configuration " |
| 7143 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7144 | board_config = ALC260_BASIC; |
| 7145 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7146 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7147 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7148 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7149 | if (err < 0) { |
| 7150 | alc_free(codec); |
| 7151 | return err; |
| 7152 | } |
| 7153 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7154 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7155 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7156 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7157 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7158 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7159 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7160 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7161 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7162 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7163 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7164 | if (!spec->adc_nids && spec->input_mux) { |
| 7165 | /* check whether NID 0x04 is valid */ |
| 7166 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7167 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7168 | /* get type */ |
| 7169 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7170 | spec->adc_nids = alc260_adc_nids_alt; |
| 7171 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7172 | } else { |
| 7173 | spec->adc_nids = alc260_adc_nids; |
| 7174 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7175 | } |
| 7176 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7177 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7178 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7179 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7180 | if (board_config == ALC260_AUTO) |
| 7181 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); |
| 7182 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7183 | spec->vmaster_nid = 0x08; |
| 7184 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7185 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7186 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7187 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7188 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7189 | if (!spec->loopback.amplist) |
| 7190 | spec->loopback.amplist = alc260_loopbacks; |
| 7191 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7192 | |
| 7193 | return 0; |
| 7194 | } |
| 7195 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7196 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7197 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7198 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7199 | * |
| 7200 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7201 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7202 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7203 | * 6-channel independent captures. |
| 7204 | * |
| 7205 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7206 | * driver yet). |
| 7207 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7208 | #define ALC882_DIGOUT_NID 0x06 |
| 7209 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7210 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7211 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7212 | #define ALC1200_DIGOUT_NID 0x10 |
| 7213 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7214 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7215 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7216 | { 8, NULL } |
| 7217 | }; |
| 7218 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7219 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7220 | static hda_nid_t alc882_dac_nids[4] = { |
| 7221 | /* front, rear, clfe, rear_surr */ |
| 7222 | 0x02, 0x03, 0x04, 0x05 |
| 7223 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7224 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7225 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7226 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7227 | #define alc882_adc_nids alc880_adc_nids |
| 7228 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7229 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7230 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7231 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7232 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7233 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7234 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7235 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7236 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7237 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7238 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7239 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7240 | /* input MUX */ |
| 7241 | /* FIXME: should be a matrix-type input source selection */ |
| 7242 | |
| 7243 | static struct hda_input_mux alc882_capture_source = { |
| 7244 | .num_items = 4, |
| 7245 | .items = { |
| 7246 | { "Mic", 0x0 }, |
| 7247 | { "Front Mic", 0x1 }, |
| 7248 | { "Line", 0x2 }, |
| 7249 | { "CD", 0x4 }, |
| 7250 | }, |
| 7251 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7252 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7253 | #define alc883_capture_source alc882_capture_source |
| 7254 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7255 | static struct hda_input_mux alc889_capture_source = { |
| 7256 | .num_items = 3, |
| 7257 | .items = { |
| 7258 | { "Front Mic", 0x0 }, |
| 7259 | { "Mic", 0x3 }, |
| 7260 | { "Line", 0x2 }, |
| 7261 | }, |
| 7262 | }; |
| 7263 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7264 | static struct hda_input_mux mb5_capture_source = { |
| 7265 | .num_items = 3, |
| 7266 | .items = { |
| 7267 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7268 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7269 | { "CD", 0x4 }, |
| 7270 | }, |
| 7271 | }; |
| 7272 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7273 | static struct hda_input_mux macmini3_capture_source = { |
| 7274 | .num_items = 2, |
| 7275 | .items = { |
| 7276 | { "Line", 0x2 }, |
| 7277 | { "CD", 0x4 }, |
| 7278 | }, |
| 7279 | }; |
| 7280 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7281 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7282 | .num_items = 4, |
| 7283 | .items = { |
| 7284 | { "Mic", 0x1 }, |
| 7285 | { "Front Mic", 0x0 }, |
| 7286 | { "Line", 0x2 }, |
| 7287 | { "CD", 0x4 }, |
| 7288 | }, |
| 7289 | }; |
| 7290 | |
| 7291 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7292 | .num_items = 2, |
| 7293 | .items = { |
| 7294 | { "Mic", 0x1 }, |
| 7295 | { "Line", 0x2 }, |
| 7296 | }, |
| 7297 | }; |
| 7298 | |
| 7299 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7300 | .num_items = 4, |
| 7301 | .items = { |
| 7302 | { "Mic", 0x0 }, |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 7303 | { "Int Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7304 | { "Line", 0x2 }, |
| 7305 | { "CD", 0x4 }, |
| 7306 | }, |
| 7307 | }; |
| 7308 | |
| 7309 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7310 | .num_items = 2, |
| 7311 | .items = { |
| 7312 | { "Mic", 0x0 }, |
| 7313 | { "Int Mic", 0x1 }, |
| 7314 | }, |
| 7315 | }; |
| 7316 | |
| 7317 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7318 | .num_items = 3, |
| 7319 | .items = { |
| 7320 | { "Mic", 0x0 }, |
| 7321 | { "Front Mic", 0x1 }, |
| 7322 | { "Line", 0x4 }, |
| 7323 | }, |
| 7324 | }; |
| 7325 | |
| 7326 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7327 | .num_items = 2, |
| 7328 | .items = { |
| 7329 | { "Mic", 0x0 }, |
| 7330 | { "Line", 0x2 }, |
| 7331 | }, |
| 7332 | }; |
| 7333 | |
| 7334 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7335 | .num_items = 2, |
| 7336 | .items = { |
| 7337 | { "Mic", 0x0 }, |
| 7338 | /* Front Mic (0x01) unused */ |
| 7339 | { "Line", 0x2 }, |
| 7340 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7341 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7342 | }, |
| 7343 | }; |
| 7344 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7345 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7346 | .num_items = 2, |
| 7347 | .items = { |
| 7348 | { "Mic", 0x01 }, |
| 7349 | { "Line", 0x2 }, /* Not sure! */ |
| 7350 | }, |
| 7351 | }; |
| 7352 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7353 | /* |
| 7354 | * 2ch mode |
| 7355 | */ |
| 7356 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7357 | { 2, NULL } |
| 7358 | }; |
| 7359 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7360 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7361 | * 2ch mode |
| 7362 | */ |
| 7363 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7364 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7365 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7366 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7367 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7368 | { } /* end */ |
| 7369 | }; |
| 7370 | |
| 7371 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7372 | * 4ch mode |
| 7373 | */ |
| 7374 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7375 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7376 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7377 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7378 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7379 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7380 | { } /* end */ |
| 7381 | }; |
| 7382 | |
| 7383 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7384 | * 6ch mode |
| 7385 | */ |
| 7386 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7387 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7388 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7389 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7390 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7391 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7392 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7393 | { } /* end */ |
| 7394 | }; |
| 7395 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7396 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7397 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7398 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7399 | { 6, alc882_3ST_ch6_init }, |
| 7400 | }; |
| 7401 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7402 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7403 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7404 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7405 | * 2ch mode |
| 7406 | */ |
| 7407 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7408 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7409 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7410 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7411 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7412 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7413 | { } /* end */ |
| 7414 | }; |
| 7415 | |
| 7416 | /* |
| 7417 | * 4ch mode |
| 7418 | */ |
| 7419 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7420 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7421 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7422 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7423 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7424 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7425 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7426 | { } /* end */ |
| 7427 | }; |
| 7428 | |
| 7429 | /* |
| 7430 | * 6ch mode |
| 7431 | */ |
| 7432 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7433 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7434 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7435 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7436 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7437 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7438 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7439 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7440 | { } /* end */ |
| 7441 | }; |
| 7442 | |
| 7443 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7444 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7445 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7446 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7447 | }; |
| 7448 | |
| 7449 | |
| 7450 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7451 | * 6ch mode |
| 7452 | */ |
| 7453 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7454 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7455 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7456 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7457 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7458 | { } /* end */ |
| 7459 | }; |
| 7460 | |
| 7461 | /* |
| 7462 | * 8ch mode |
| 7463 | */ |
| 7464 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7465 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7466 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7467 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7468 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7469 | { } /* end */ |
| 7470 | }; |
| 7471 | |
| 7472 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7473 | { 6, alc882_sixstack_ch6_init }, |
| 7474 | { 8, alc882_sixstack_ch8_init }, |
| 7475 | }; |
| 7476 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7477 | |
| 7478 | /* Macbook Air 2,1 */ |
| 7479 | |
| 7480 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7481 | { 2, NULL }, |
| 7482 | }; |
| 7483 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7484 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7485 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7486 | */ |
| 7487 | |
| 7488 | /* |
| 7489 | * 2ch mode |
| 7490 | */ |
| 7491 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7492 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7493 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7494 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7495 | { } /* end */ |
| 7496 | }; |
| 7497 | |
| 7498 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7499 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7500 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7501 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7502 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7503 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7504 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7505 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7506 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7507 | { } /* end */ |
| 7508 | }; |
| 7509 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7510 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7511 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7512 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7513 | }; |
| 7514 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7515 | /* |
| 7516 | * 2ch |
| 7517 | * Speakers/Woofer/HP = Front |
| 7518 | * LineIn = Input |
| 7519 | */ |
| 7520 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7521 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7522 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7523 | { } /* end */ |
| 7524 | }; |
| 7525 | |
| 7526 | /* |
| 7527 | * 6ch mode |
| 7528 | * Speakers/HP = Front |
| 7529 | * Woofer = LFE |
| 7530 | * LineIn = Surround |
| 7531 | */ |
| 7532 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7533 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7534 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7535 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7536 | { } /* end */ |
| 7537 | }; |
| 7538 | |
| 7539 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7540 | { 2, alc885_mb5_ch2_init }, |
| 7541 | { 6, alc885_mb5_ch6_init }, |
| 7542 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7543 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7544 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7545 | |
| 7546 | /* |
| 7547 | * 2ch mode |
| 7548 | */ |
| 7549 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7550 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7551 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7552 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7553 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7554 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7555 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7556 | { } /* end */ |
| 7557 | }; |
| 7558 | |
| 7559 | /* |
| 7560 | * 4ch mode |
| 7561 | */ |
| 7562 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7563 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7564 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7565 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7566 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7567 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7568 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7569 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7570 | { } /* end */ |
| 7571 | }; |
| 7572 | |
| 7573 | /* |
| 7574 | * 6ch mode |
| 7575 | */ |
| 7576 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7577 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7578 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7579 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7580 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7581 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7582 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7583 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7584 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7585 | { } /* end */ |
| 7586 | }; |
| 7587 | |
| 7588 | /* |
| 7589 | * 8ch mode |
| 7590 | */ |
| 7591 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7592 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7593 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7594 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7595 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7596 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7597 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7598 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7599 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7600 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7601 | { } /* end */ |
| 7602 | }; |
| 7603 | |
| 7604 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7605 | { 2, alc883_4ST_ch2_init }, |
| 7606 | { 4, alc883_4ST_ch4_init }, |
| 7607 | { 6, alc883_4ST_ch6_init }, |
| 7608 | { 8, alc883_4ST_ch8_init }, |
| 7609 | }; |
| 7610 | |
| 7611 | |
| 7612 | /* |
| 7613 | * 2ch mode |
| 7614 | */ |
| 7615 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7616 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7617 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7618 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7619 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7620 | { } /* end */ |
| 7621 | }; |
| 7622 | |
| 7623 | /* |
| 7624 | * 4ch mode |
| 7625 | */ |
| 7626 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7627 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7628 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7629 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7630 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7631 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7632 | { } /* end */ |
| 7633 | }; |
| 7634 | |
| 7635 | /* |
| 7636 | * 6ch mode |
| 7637 | */ |
| 7638 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7639 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7640 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7641 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7642 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7643 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7644 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7645 | { } /* end */ |
| 7646 | }; |
| 7647 | |
| 7648 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7649 | { 2, alc883_3ST_ch2_intel_init }, |
| 7650 | { 4, alc883_3ST_ch4_intel_init }, |
| 7651 | { 6, alc883_3ST_ch6_intel_init }, |
| 7652 | }; |
| 7653 | |
| 7654 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7655 | * 2ch mode |
| 7656 | */ |
| 7657 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7658 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7659 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7660 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7661 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7662 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7663 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7664 | { } /* end */ |
| 7665 | }; |
| 7666 | |
| 7667 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7668 | * 6ch mode |
| 7669 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7670 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7671 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7672 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7673 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7674 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7675 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7676 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7677 | { } /* end */ |
| 7678 | }; |
| 7679 | |
| 7680 | /* |
| 7681 | * 8ch mode |
| 7682 | */ |
| 7683 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7684 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7685 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7686 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7687 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7688 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7689 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7690 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7691 | { } /* end */ |
| 7692 | }; |
| 7693 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7694 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7695 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7696 | { 6, alc889_ch6_intel_init }, |
| 7697 | { 8, alc889_ch8_intel_init }, |
| 7698 | }; |
| 7699 | |
| 7700 | /* |
| 7701 | * 6ch mode |
| 7702 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7703 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7704 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7705 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7706 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7707 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7708 | { } /* end */ |
| 7709 | }; |
| 7710 | |
| 7711 | /* |
| 7712 | * 8ch mode |
| 7713 | */ |
| 7714 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7715 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7716 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7717 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7718 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7719 | { } /* end */ |
| 7720 | }; |
| 7721 | |
| 7722 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7723 | { 6, alc883_sixstack_ch6_init }, |
| 7724 | { 8, alc883_sixstack_ch8_init }, |
| 7725 | }; |
| 7726 | |
| 7727 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7728 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7729 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7730 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7731 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7732 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7733 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7734 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7735 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7736 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7737 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7738 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7739 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7740 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7741 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7743 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7744 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7745 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7746 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7747 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7748 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7750 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7751 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7752 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7753 | { } /* end */ |
| 7754 | }; |
| 7755 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7756 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7757 | |
| 7758 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7759 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7760 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7761 | { } |
| 7762 | }; |
| 7763 | |
| 7764 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7765 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7766 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7767 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7768 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7769 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7770 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7771 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7772 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7774 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7775 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7776 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7777 | { } /* end */ |
| 7778 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7779 | |
| 7780 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7781 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7782 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7783 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7784 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7785 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7786 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7787 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7788 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7789 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7790 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7791 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7792 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7793 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7794 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7795 | { } /* end */ |
| 7796 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7797 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7798 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7799 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7800 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7801 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7802 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7803 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7804 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7805 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7806 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7807 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7808 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7809 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7810 | { } /* end */ |
| 7811 | }; |
| 7812 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7813 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7814 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7815 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7816 | { } /* end */ |
| 7817 | }; |
| 7818 | |
| 7819 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7820 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7822 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7823 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7824 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7825 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7826 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7828 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7829 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7830 | { } /* end */ |
| 7831 | }; |
| 7832 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7833 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7834 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7835 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7837 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7838 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7839 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7840 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7843 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7844 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7845 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7846 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7847 | { } /* end */ |
| 7848 | }; |
| 7849 | |
| 7850 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7851 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7852 | */ |
| 7853 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7855 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7857 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7858 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7859 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7860 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7861 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7862 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7863 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7864 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7865 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7866 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7867 | { } /* end */ |
| 7868 | }; |
| 7869 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7870 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7871 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7872 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7873 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7874 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7875 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7876 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7877 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7879 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7880 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7881 | { } /* end */ |
| 7882 | }; |
| 7883 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7884 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7885 | { |
| 7886 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7887 | .name = "Channel Mode", |
| 7888 | .info = alc_ch_mode_info, |
| 7889 | .get = alc_ch_mode_get, |
| 7890 | .put = alc_ch_mode_put, |
| 7891 | }, |
| 7892 | { } /* end */ |
| 7893 | }; |
| 7894 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7895 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7896 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7897 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7898 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7899 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7900 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7901 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7902 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7903 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7905 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7906 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7907 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7908 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7909 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7910 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7911 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7912 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7913 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7914 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7915 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7916 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7917 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7918 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7919 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7920 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7921 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7922 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7923 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7924 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7925 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7926 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7927 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7928 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7929 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7930 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7931 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7932 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7933 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7934 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7935 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7936 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7937 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7938 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7939 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7940 | |
| 7941 | /* FIXME: use matrix-type input source selection */ |
| 7942 | /* 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] | 7943 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7944 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7945 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7946 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7947 | /* ADC2: mute amp left and right */ |
| 7948 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7949 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7950 | /* ADC3: mute amp left and right */ |
| 7951 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7952 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7953 | |
| 7954 | { } |
| 7955 | }; |
| 7956 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7957 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7958 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7959 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7960 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7961 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7962 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7963 | /* ADC1: mute amp left and right */ |
| 7964 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7965 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7966 | { } |
| 7967 | }; |
| 7968 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7969 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7970 | /* change to EAPD mode */ |
| 7971 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7972 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7973 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7974 | }; |
| 7975 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7976 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7977 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7978 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7979 | { } |
| 7980 | }; |
| 7981 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7982 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7983 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7984 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7985 | {} |
| 7986 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7987 | |
| 7988 | static struct hda_verb alc885_init_verbs[] = { |
| 7989 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7990 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7991 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7992 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7993 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7994 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7995 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7996 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7997 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7998 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7999 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8000 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8001 | |
| 8002 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8003 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8004 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8005 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8006 | /* Front Pin: output 0 (0x0c) */ |
| 8007 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8008 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8009 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8010 | /* Rear Pin: output 1 (0x0d) */ |
| 8011 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8012 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8013 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8014 | /* CLFE Pin: output 2 (0x0e) */ |
| 8015 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8016 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8017 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8018 | /* Side Pin: output 3 (0x0f) */ |
| 8019 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8020 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8021 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8022 | /* Mic (rear) pin: input vref at 80% */ |
| 8023 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8024 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8025 | /* Front Mic pin: input vref at 80% */ |
| 8026 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8027 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8028 | /* Line In pin: input */ |
| 8029 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8030 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8031 | |
| 8032 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8033 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8034 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8035 | /* Input mixer2 */ |
| 8036 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8037 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8039 | /* ADC2: mute amp left and right */ |
| 8040 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8041 | /* ADC3: mute amp left and right */ |
| 8042 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8043 | |
| 8044 | { } |
| 8045 | }; |
| 8046 | |
| 8047 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8051 | { } |
| 8052 | }; |
| 8053 | |
| 8054 | |
| 8055 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8056 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8057 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8059 | { } |
| 8060 | }; |
| 8061 | |
| 8062 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8063 | #define alc883_init_verbs alc882_base_init_verbs |
| 8064 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8065 | /* Mac Pro test */ |
| 8066 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8067 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8068 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8069 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8070 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8071 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8072 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8073 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8074 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8075 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8076 | { } /* end */ |
| 8077 | }; |
| 8078 | |
| 8079 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8080 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8082 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8083 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8084 | /* Front Pin: output 0 (0x0c) */ |
| 8085 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8086 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8087 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8088 | /* Front Mic pin: input vref at 80% */ |
| 8089 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8090 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8091 | /* Speaker: output */ |
| 8092 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8093 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8094 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8095 | /* Headphone output (output 0 - 0x0c) */ |
| 8096 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8097 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8098 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8099 | |
| 8100 | /* FIXME: use matrix-type input source selection */ |
| 8101 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8102 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8103 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8104 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8105 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8106 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8107 | /* Input mixer2 */ |
| 8108 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8109 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8110 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8111 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8112 | /* Input mixer3 */ |
| 8113 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8114 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8115 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8116 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8117 | /* ADC1: mute amp left and right */ |
| 8118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8119 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8120 | /* ADC2: mute amp left and right */ |
| 8121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8122 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8123 | /* ADC3: mute amp left and right */ |
| 8124 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8125 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8126 | |
| 8127 | { } |
| 8128 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8129 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8130 | /* Macbook 5,1 */ |
| 8131 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8132 | /* DACs */ |
| 8133 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8134 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8135 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8136 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8137 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8138 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8139 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8140 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8141 | /* Surround mixer */ |
| 8142 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8143 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8144 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8145 | /* LFE mixer */ |
| 8146 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8147 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8149 | /* HP mixer */ |
| 8150 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8151 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8152 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8153 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8154 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8155 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8156 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8157 | /* LFE Pin (0x0e) */ |
| 8158 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8159 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8160 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8161 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8162 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8163 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8164 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8165 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8166 | /* Front Mic pin: input vref at 80% */ |
| 8167 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8168 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8169 | /* Line In pin */ |
| 8170 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8171 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8172 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8174 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8175 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8176 | { } |
| 8177 | }; |
| 8178 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8179 | /* Macmini 3,1 */ |
| 8180 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8181 | /* DACs */ |
| 8182 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8183 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8184 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8185 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8186 | /* Front mixer */ |
| 8187 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8188 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8190 | /* Surround mixer */ |
| 8191 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8192 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8194 | /* LFE mixer */ |
| 8195 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8196 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8197 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8198 | /* HP mixer */ |
| 8199 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8200 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8201 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8202 | /* Front Pin (0x0c) */ |
| 8203 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8204 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8205 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8206 | /* LFE Pin (0x0e) */ |
| 8207 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8208 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8209 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8210 | /* HP Pin (0x0f) */ |
| 8211 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8212 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8213 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8214 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8215 | /* Line In pin */ |
| 8216 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8217 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8218 | |
| 8219 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8220 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8221 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8222 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8223 | { } |
| 8224 | }; |
| 8225 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8226 | |
| 8227 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8228 | /*Internal and HP Speaker Mixer*/ |
| 8229 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8232 | /*Internal Speaker Pin (0x0c)*/ |
| 8233 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8234 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8235 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8236 | /* HP Pin: output 0 (0x0e) */ |
| 8237 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8238 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8239 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8240 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8241 | /* Line in (is hp when jack connected)*/ |
| 8242 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8243 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8244 | |
| 8245 | { } |
| 8246 | }; |
| 8247 | |
| 8248 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8249 | /* Macbook Pro rev3 */ |
| 8250 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8251 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8253 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8254 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8255 | /* Rear mixer */ |
| 8256 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8257 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8259 | /* HP mixer */ |
| 8260 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8261 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8262 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8263 | /* Front Pin: output 0 (0x0c) */ |
| 8264 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8265 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8266 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8267 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8268 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8269 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8270 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8271 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8272 | /* Mic (rear) pin: input vref at 80% */ |
| 8273 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8274 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8275 | /* Front Mic pin: input vref at 80% */ |
| 8276 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8277 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8278 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8279 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8280 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8281 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8282 | |
| 8283 | /* FIXME: use matrix-type input source selection */ |
| 8284 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8285 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8287 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8288 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8290 | /* Input mixer2 */ |
| 8291 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8293 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8295 | /* Input mixer3 */ |
| 8296 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8297 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8298 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8299 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8300 | /* ADC1: mute amp left and right */ |
| 8301 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8302 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8303 | /* ADC2: mute amp left and right */ |
| 8304 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8305 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8306 | /* ADC3: mute amp left and right */ |
| 8307 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8308 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8309 | |
| 8310 | { } |
| 8311 | }; |
| 8312 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8313 | /* iMac 9,1 */ |
| 8314 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8315 | /* Internal Speaker Pin (0x0c) */ |
| 8316 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8317 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8318 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8319 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8320 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8321 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8322 | /* HP Pin: Rear */ |
| 8323 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8324 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8325 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8326 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8327 | /* Line in Rear */ |
| 8328 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8329 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8330 | /* Front Mic pin: input vref at 80% */ |
| 8331 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8332 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8333 | /* Rear mixer */ |
| 8334 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8335 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8336 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8337 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 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 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8344 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8345 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8346 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8347 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8348 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8350 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8351 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8352 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8353 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8354 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8355 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8356 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8357 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8358 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8359 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8360 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8361 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8362 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8363 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8364 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8365 | { } |
| 8366 | }; |
| 8367 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8368 | /* iMac 24 mixer. */ |
| 8369 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8370 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8371 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8372 | { } /* end */ |
| 8373 | }; |
| 8374 | |
| 8375 | /* iMac 24 init verbs. */ |
| 8376 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8377 | /* Internal speakers: output 0 (0x0c) */ |
| 8378 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8379 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8380 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8381 | /* Internal speakers: output 0 (0x0c) */ |
| 8382 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8383 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8384 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8385 | /* Headphone: output 0 (0x0c) */ |
| 8386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8387 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8388 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8389 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8390 | /* Front Mic: input vref at 80% */ |
| 8391 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8392 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8393 | { } |
| 8394 | }; |
| 8395 | |
| 8396 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8397 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8398 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8399 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8400 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8401 | spec->autocfg.hp_pins[0] = 0x14; |
| 8402 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8403 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8404 | } |
| 8405 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8406 | #define alc885_mb5_setup alc885_imac24_setup |
| 8407 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8408 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8409 | /* Macbook Air 2,1 */ |
| 8410 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8411 | { |
| 8412 | struct alc_spec *spec = codec->spec; |
| 8413 | |
| 8414 | spec->autocfg.hp_pins[0] = 0x14; |
| 8415 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8416 | } |
| 8417 | |
| 8418 | |
| 8419 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8420 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8421 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8422 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8423 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8424 | spec->autocfg.hp_pins[0] = 0x15; |
| 8425 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8426 | } |
| 8427 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8428 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8429 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8430 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8431 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8432 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8433 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8434 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8435 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8436 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8437 | static struct hda_verb alc882_targa_verbs[] = { |
| 8438 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8439 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8440 | |
| 8441 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8442 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8443 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8444 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8445 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8446 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8447 | |
| 8448 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8449 | { } /* end */ |
| 8450 | }; |
| 8451 | |
| 8452 | /* toggle speaker-output according to the hp-jack state */ |
| 8453 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8454 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8455 | struct alc_spec *spec = codec->spec; |
| 8456 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8457 | 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] | 8458 | spec->jack_present ? 1 : 3); |
| 8459 | } |
| 8460 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8461 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8462 | { |
| 8463 | struct alc_spec *spec = codec->spec; |
| 8464 | |
| 8465 | spec->autocfg.hp_pins[0] = 0x14; |
| 8466 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8467 | } |
| 8468 | |
| 8469 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8470 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8471 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8472 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8473 | } |
| 8474 | |
| 8475 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8476 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8477 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8478 | |
| 8479 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8481 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8482 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8483 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8484 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8485 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8486 | |
| 8487 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8488 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8489 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8490 | { } /* end */ |
| 8491 | }; |
| 8492 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8493 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8494 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8495 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8496 | |
| 8497 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8498 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8499 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8500 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8501 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8502 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8503 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8504 | |
| 8505 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8506 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8507 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8508 | { } /* end */ |
| 8509 | }; |
| 8510 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8511 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8512 | { |
| 8513 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8514 | |
| 8515 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8516 | AC_VERB_GET_GPIO_DATA, 0); |
| 8517 | |
| 8518 | if (!muted) |
| 8519 | gpiostate |= (1 << pin); |
| 8520 | else |
| 8521 | gpiostate &= ~(1 << pin); |
| 8522 | |
| 8523 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8524 | AC_VERB_GET_GPIO_MASK, 0); |
| 8525 | gpiomask |= (1 << pin); |
| 8526 | |
| 8527 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8528 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8529 | gpiodir |= (1 << pin); |
| 8530 | |
| 8531 | |
| 8532 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8533 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8534 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8535 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8536 | |
| 8537 | msleep(1); |
| 8538 | |
| 8539 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8540 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8541 | } |
| 8542 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8543 | /* set up GPIO at initialization */ |
| 8544 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8545 | { |
| 8546 | alc882_gpio_mute(codec, 0, 0); |
| 8547 | alc882_gpio_mute(codec, 1, 0); |
| 8548 | } |
| 8549 | |
| 8550 | /* set up GPIO and update auto-muting at initialization */ |
| 8551 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8552 | { |
| 8553 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8554 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8555 | } |
| 8556 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8557 | /* |
| 8558 | * generic initialization of ADC, input mixers and output mixers |
| 8559 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8560 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8561 | /* |
| 8562 | * Unmute ADC0-2 and set the default input to mic-in |
| 8563 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8564 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8565 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8566 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8567 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8568 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8569 | /* |
| 8570 | * Set up output mixers (0x0c - 0x0f) |
| 8571 | */ |
| 8572 | /* set vol=0 to output mixers */ |
| 8573 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8574 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8575 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8576 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8577 | /* set up input amps for analog loopback */ |
| 8578 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8581 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8582 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8583 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8584 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8585 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8586 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8587 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8588 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8589 | |
| 8590 | /* FIXME: use matrix-type input source selection */ |
| 8591 | /* 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] | 8592 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8593 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8594 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8595 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8596 | { } |
| 8597 | }; |
| 8598 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8599 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8600 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8601 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8602 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8603 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8604 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8605 | { } /* end */ |
| 8606 | }; |
| 8607 | |
| 8608 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8609 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8610 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8611 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8612 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8613 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8614 | { } /* end */ |
| 8615 | }; |
| 8616 | |
| 8617 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8618 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8619 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8620 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8621 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8622 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8623 | { } /* end */ |
| 8624 | }; |
| 8625 | |
| 8626 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8627 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8628 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8629 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8630 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8631 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8632 | { } /* end */ |
| 8633 | }; |
| 8634 | |
| 8635 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8636 | { 2, alc889A_mb31_ch2_init }, |
| 8637 | { 4, alc889A_mb31_ch4_init }, |
| 8638 | { 5, alc889A_mb31_ch5_init }, |
| 8639 | { 6, alc889A_mb31_ch6_init }, |
| 8640 | }; |
| 8641 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8642 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8643 | /* eanable EAPD on medion laptop */ |
| 8644 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8645 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8646 | { } |
| 8647 | }; |
| 8648 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8649 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8650 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8651 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8652 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8653 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8654 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8655 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8656 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8657 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8658 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8660 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8661 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8662 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8663 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8664 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8665 | { } /* end */ |
| 8666 | }; |
| 8667 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8668 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8669 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8670 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8671 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8672 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8674 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8676 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8677 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8678 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8679 | { } /* end */ |
| 8680 | }; |
| 8681 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8682 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8683 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8684 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8685 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8686 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8688 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8689 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8690 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8691 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8692 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8693 | { } /* end */ |
| 8694 | }; |
| 8695 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8696 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8697 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8698 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8699 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8700 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8701 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8702 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8703 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8705 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8707 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8708 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8709 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8710 | { } /* end */ |
| 8711 | }; |
| 8712 | |
| 8713 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8714 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8715 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8716 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8717 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8718 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8719 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8720 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8721 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8724 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8726 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8728 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8729 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8731 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8732 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8733 | { } /* end */ |
| 8734 | }; |
| 8735 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8736 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8737 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8738 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8739 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8740 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8741 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8742 | HDA_OUTPUT), |
| 8743 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8744 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8745 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8746 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8747 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8748 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8749 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8750 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8751 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8752 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8753 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8754 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8755 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8756 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8757 | { } /* end */ |
| 8758 | }; |
| 8759 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8760 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8761 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8762 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8763 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8764 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8765 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8766 | HDA_OUTPUT), |
| 8767 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8768 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8769 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8770 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8771 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8772 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8773 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8774 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8775 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8776 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8777 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8778 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8779 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8780 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8781 | { } /* end */ |
| 8782 | }; |
| 8783 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8784 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8785 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8786 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8787 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8788 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8789 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8790 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8791 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8792 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8794 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8795 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8796 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8797 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8799 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8802 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8803 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8804 | { } /* end */ |
| 8805 | }; |
| 8806 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8807 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8808 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8809 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8810 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8811 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8812 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8813 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8814 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8815 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8816 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8817 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8818 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8819 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8820 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8821 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8822 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8823 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8824 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8825 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8826 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8827 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8828 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8829 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8830 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8831 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8832 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8833 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8834 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8836 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8837 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8838 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8839 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8840 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8841 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8842 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8843 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8844 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8845 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8846 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8847 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8848 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8849 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8850 | { } /* end */ |
| 8851 | }; |
| 8852 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8853 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8855 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8856 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8857 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8858 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8859 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8860 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8861 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8862 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8863 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8864 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8865 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8866 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8867 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8868 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8870 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8871 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 8873 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8874 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8875 | { } /* end */ |
| 8876 | }; |
| 8877 | |
| 8878 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8879 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8880 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8881 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8882 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8883 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8886 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8887 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8888 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8889 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8890 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8891 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8892 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8893 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8894 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8896 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8897 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8898 | { } /* end */ |
| 8899 | }; |
| 8900 | |
| 8901 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8902 | /* Unmute front mixer */ |
| 8903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8904 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8905 | |
| 8906 | /* Set speaker pin to front mixer */ |
| 8907 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8908 | |
| 8909 | /* Init headphone pin */ |
| 8910 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8911 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8912 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8913 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8914 | |
| 8915 | { } /* end */ |
| 8916 | }; |
| 8917 | |
| 8918 | /* toggle speaker-output according to the hp-jack state */ |
| 8919 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8920 | { |
| 8921 | struct alc_spec *spec = codec->spec; |
| 8922 | |
| 8923 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8924 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8925 | } |
| 8926 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8927 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8928 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8929 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8930 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8931 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8932 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8933 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8934 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8935 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8936 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8937 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8938 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8939 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8940 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8941 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8942 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8943 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8944 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8945 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8946 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8947 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8948 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8949 | { } /* end */ |
| 8950 | }; |
| 8951 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8952 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8953 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8954 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8955 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8956 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8957 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8958 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8959 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8960 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8961 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8962 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8963 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8964 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8965 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8966 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8967 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8968 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8969 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8971 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8972 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8973 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8974 | { } /* end */ |
| 8975 | }; |
| 8976 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8977 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8978 | /* Output mixers */ |
| 8979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8981 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8982 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8983 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8984 | HDA_OUTPUT), |
| 8985 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8986 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8987 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8988 | /* Output switches */ |
| 8989 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8990 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8991 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8992 | /* Boost mixers */ |
| 8993 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8994 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8995 | /* Input mixers */ |
| 8996 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9000 | { } /* end */ |
| 9001 | }; |
| 9002 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9003 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9004 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9005 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9006 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9007 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9008 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 9009 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9010 | { } /* end */ |
| 9011 | }; |
| 9012 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9013 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9014 | .ops = &snd_hda_bind_vol, |
| 9015 | .values = { |
| 9016 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9017 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9018 | 0 |
| 9019 | }, |
| 9020 | }; |
| 9021 | |
| 9022 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9023 | .ops = &snd_hda_bind_sw, |
| 9024 | .values = { |
| 9025 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9026 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9027 | 0 |
| 9028 | }, |
| 9029 | }; |
| 9030 | |
| 9031 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9032 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9033 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9034 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9035 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9036 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9038 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9039 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9040 | { } /* end */ |
| 9041 | }; |
| 9042 | |
| 9043 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9044 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9045 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9046 | { |
| 9047 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9048 | /* .name = "Capture Source", */ |
| 9049 | .name = "Input Source", |
| 9050 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9051 | .info = alc_mux_enum_info, |
| 9052 | .get = alc_mux_enum_get, |
| 9053 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9054 | }, |
| 9055 | { } /* end */ |
| 9056 | }; |
| 9057 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9058 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9059 | { |
| 9060 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9061 | .name = "Channel Mode", |
| 9062 | .info = alc_ch_mode_info, |
| 9063 | .get = alc_ch_mode_get, |
| 9064 | .put = alc_ch_mode_put, |
| 9065 | }, |
| 9066 | { } /* end */ |
| 9067 | }; |
| 9068 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9069 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9070 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9071 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9072 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9073 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9074 | spec->autocfg.hp_pins[0] = 0x15; |
| 9075 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9076 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9077 | } |
| 9078 | |
| 9079 | /* auto-toggle front mic */ |
| 9080 | /* |
| 9081 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 9082 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9083 | 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] | 9084 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9085 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 9086 | } |
| 9087 | */ |
| 9088 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9089 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9090 | /* HP */ |
| 9091 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9092 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9093 | /* Subwoofer */ |
| 9094 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9095 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9096 | |
| 9097 | /* enable unsolicited event */ |
| 9098 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9099 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9100 | |
| 9101 | { } /* end */ |
| 9102 | }; |
| 9103 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9104 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9105 | /* HP */ |
| 9106 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9107 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9108 | /* Int speaker */ |
| 9109 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9110 | |
| 9111 | /* enable unsolicited event */ |
| 9112 | /* |
| 9113 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9114 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9115 | */ |
| 9116 | |
| 9117 | { } /* end */ |
| 9118 | }; |
| 9119 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9120 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9121 | /* HP */ |
| 9122 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9123 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9124 | /* Int speaker */ |
| 9125 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9126 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9127 | |
| 9128 | /* enable unsolicited event */ |
| 9129 | {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] | 9130 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9131 | |
| 9132 | { } /* end */ |
| 9133 | }; |
| 9134 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9135 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9136 | /* HP */ |
| 9137 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9138 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9139 | /* Subwoofer */ |
| 9140 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9141 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9142 | |
| 9143 | /* enable unsolicited event */ |
| 9144 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9145 | |
| 9146 | { } /* end */ |
| 9147 | }; |
| 9148 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9149 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9151 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9152 | |
| 9153 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9154 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9155 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9156 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9157 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9158 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9159 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9160 | /* Connect Mic jack to CLFE */ |
| 9161 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9162 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9163 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9164 | /* Connect Line-in jack to Surround */ |
| 9165 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9166 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9167 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9168 | /* Connect HP out jack to Front */ |
| 9169 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9170 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9171 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9172 | |
| 9173 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9174 | |
| 9175 | { } /* end */ |
| 9176 | }; |
| 9177 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9178 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9179 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9180 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9181 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9182 | { } /* end */ |
| 9183 | }; |
| 9184 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9185 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9186 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9188 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9189 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9190 | { } /* end */ |
| 9191 | }; |
| 9192 | |
| 9193 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9194 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9195 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9196 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9197 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9198 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9199 | { } /* end */ |
| 9200 | }; |
| 9201 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9202 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9203 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9204 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9205 | |
| 9206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9207 | |
| 9208 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9209 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9210 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9211 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9212 | { } /* end */ |
| 9213 | }; |
| 9214 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9215 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9216 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9217 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9218 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9219 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9220 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9221 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9222 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9223 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9224 | { } /* end */ |
| 9225 | }; |
| 9226 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9227 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9228 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9229 | { } |
| 9230 | }; |
| 9231 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9232 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9233 | /* HP */ |
| 9234 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9236 | |
| 9237 | /* enable unsolicited event */ |
| 9238 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9239 | |
| 9240 | { } /* end */ |
| 9241 | }; |
| 9242 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9243 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9244 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9245 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9246 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9247 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9248 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9249 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9250 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9251 | } |
| 9252 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9253 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9254 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9255 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9256 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9257 | {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] | 9258 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9259 | }; |
| 9260 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9261 | /* |
| 9262 | * 2ch mode |
| 9263 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9264 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9265 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9266 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9267 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9268 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9269 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9270 | }; |
| 9271 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9272 | /* |
| 9273 | * 4ch mode |
| 9274 | */ |
| 9275 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9276 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9277 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9278 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9279 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9280 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9281 | { } /* end */ |
| 9282 | }; |
| 9283 | |
| 9284 | /* |
| 9285 | * 6ch mode |
| 9286 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9287 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9288 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9289 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9290 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9291 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9292 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9293 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9294 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9295 | }; |
| 9296 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9297 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9298 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9299 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9300 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9301 | }; |
| 9302 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9303 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9304 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9305 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9306 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9307 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9308 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9309 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9310 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9311 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9312 | } |
| 9313 | |
| 9314 | /* toggle RCA according to the front-jack state */ |
| 9315 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9316 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9317 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9318 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9319 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9320 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9321 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9322 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9323 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9324 | unsigned int res) |
| 9325 | { |
| 9326 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9327 | alc888_lenovo_ms7195_front_automute(codec); |
| 9328 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9329 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9330 | } |
| 9331 | |
| 9332 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9335 | |
| 9336 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9337 | |
| 9338 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9339 | { } /* end */ |
| 9340 | }; |
| 9341 | |
| 9342 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9343 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9344 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9345 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9346 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9347 | spec->autocfg.hp_pins[0] = 0x14; |
| 9348 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9349 | } |
| 9350 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9351 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9352 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9353 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9354 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9355 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9356 | { |
| 9357 | unsigned int present; |
| 9358 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9359 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9360 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9361 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9362 | } |
| 9363 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9364 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9365 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9366 | struct alc_spec *spec = codec->spec; |
| 9367 | |
| 9368 | spec->autocfg.hp_pins[0] = 0x15; |
| 9369 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9370 | } |
| 9371 | |
| 9372 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9373 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9374 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9375 | alc883_clevo_m720_mic_automute(codec); |
| 9376 | } |
| 9377 | |
| 9378 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9379 | unsigned int res) |
| 9380 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9381 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9382 | case ALC880_MIC_EVENT: |
| 9383 | alc883_clevo_m720_mic_automute(codec); |
| 9384 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9385 | default: |
| 9386 | alc_automute_amp_unsol_event(codec, res); |
| 9387 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9388 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9389 | } |
| 9390 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9391 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9392 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9393 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9394 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9395 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9396 | spec->autocfg.hp_pins[0] = 0x14; |
| 9397 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9398 | } |
| 9399 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9400 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9401 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9402 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9403 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9404 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9405 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9406 | } |
| 9407 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9408 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9409 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9410 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9411 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9412 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9413 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9414 | } |
| 9415 | |
| 9416 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9417 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9418 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9419 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9420 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9421 | HDA_AMP_MUTE, bits); |
| 9422 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9423 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9424 | } |
| 9425 | |
| 9426 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9427 | unsigned int res) |
| 9428 | { |
| 9429 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9430 | alc883_lenovo_101e_all_automute(codec); |
| 9431 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9432 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9433 | } |
| 9434 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9435 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9436 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9437 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9438 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9439 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9440 | spec->autocfg.hp_pins[0] = 0x14; |
| 9441 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9442 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9443 | } |
| 9444 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9445 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9446 | /* HP Pin: output 0 (0x0c) */ |
| 9447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9449 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9450 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9452 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9453 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9454 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9455 | /* eanable EAPD on medion laptop */ |
| 9456 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9457 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9458 | /* enable unsolicited event */ |
| 9459 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9460 | { } |
| 9461 | }; |
| 9462 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9463 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9464 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9465 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9466 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9467 | { } /* end */ |
| 9468 | }; |
| 9469 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9470 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9471 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9472 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9473 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9474 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9475 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9476 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9477 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9478 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9479 | } |
| 9480 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9481 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9482 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9483 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9484 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9485 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9486 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9487 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9488 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9489 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9490 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9491 | } |
| 9492 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9493 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9494 | { |
| 9495 | struct alc_spec *spec = codec->spec; |
| 9496 | |
| 9497 | spec->autocfg.hp_pins[0] = 0x15; |
| 9498 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9499 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9500 | } |
| 9501 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9502 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9503 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9504 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9505 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9506 | /* enable unsolicited event */ |
| 9507 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9508 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9509 | { } /* end */ |
| 9510 | }; |
| 9511 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9512 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9513 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9514 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9515 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9516 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9517 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9518 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9519 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9520 | spec->ext_mic.pin = 0x18; |
| 9521 | spec->int_mic.pin = 0x19; |
| 9522 | spec->ext_mic.mux_idx = 0; |
| 9523 | spec->int_mic.mux_idx = 1; |
| 9524 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9525 | } |
| 9526 | |
| 9527 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9528 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9529 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9530 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9531 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9532 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9533 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9534 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9535 | /* enable unsolicited event */ |
| 9536 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9537 | { } /* end */ |
| 9538 | }; |
| 9539 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9540 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9541 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9542 | struct alc_spec *spec = codec->spec; |
| 9543 | |
| 9544 | spec->autocfg.hp_pins[0] = 0x14; |
| 9545 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9546 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9547 | } |
| 9548 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9549 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9550 | /* Init rear pin (used as headphone output) */ |
| 9551 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9552 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9553 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9554 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9555 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9556 | /* Init line 2 pin (used as headphone out by default) */ |
| 9557 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9558 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9559 | { } /* end */ |
| 9560 | }; |
| 9561 | |
| 9562 | /* Mute speakers according to the headphone jack state */ |
| 9563 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9564 | { |
| 9565 | unsigned int present; |
| 9566 | |
| 9567 | /* Mute only in 2ch or 4ch mode */ |
| 9568 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9569 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9570 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9571 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9572 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9573 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9574 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9575 | } |
| 9576 | } |
| 9577 | |
| 9578 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9579 | { |
| 9580 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9581 | alc889A_mb31_automute(codec); |
| 9582 | } |
| 9583 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9584 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9585 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9586 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9587 | #endif |
| 9588 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9589 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9590 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9591 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9592 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9593 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9594 | |
| 9595 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9596 | ALC1200_DIGOUT_NID, 0, |
| 9597 | }; |
| 9598 | |
| 9599 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9600 | ALC883_DIGOUT_NID, 0, |
| 9601 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9602 | |
| 9603 | /* |
| 9604 | * configuration and preset |
| 9605 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9606 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9607 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9608 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9609 | [ALC882_ARIMA] = "arima", |
| 9610 | [ALC882_W2JC] = "w2jc", |
| 9611 | [ALC882_TARGA] = "targa", |
| 9612 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9613 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9614 | [ALC885_MACPRO] = "macpro", |
| 9615 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9616 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9617 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9618 | [ALC885_MBP3] = "mbp3", |
| 9619 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9620 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9621 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9622 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9623 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9624 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9625 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9626 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9627 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9628 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9629 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9630 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9631 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9632 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9633 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9634 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9635 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9636 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9637 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9638 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9639 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9640 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9641 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9642 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9643 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9644 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9645 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9646 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9647 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9648 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9649 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9650 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9651 | [ALC889A_INTEL] = "intel-alc889a", |
| 9652 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9653 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9654 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9655 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9656 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9657 | }; |
| 9658 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9659 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9660 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9661 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9662 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9663 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9664 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9665 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9666 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9667 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9668 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9669 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9670 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9671 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9672 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9673 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9674 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9675 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9676 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9677 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9678 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9679 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9680 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9681 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9682 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9683 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9684 | /* default Acer -- disabled as it causes more problems. |
| 9685 | * model=auto should work fine now |
| 9686 | */ |
| 9687 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9688 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9689 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9690 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9691 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9692 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9693 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9694 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9695 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9696 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9697 | |
| 9698 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9699 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9700 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9701 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9702 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9703 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9704 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9705 | 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] | 9706 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9707 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9708 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9709 | |
| 9710 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9711 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9712 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9713 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9714 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9715 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9716 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9717 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9718 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9719 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9720 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9721 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9722 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9723 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9724 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9725 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9726 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9727 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9728 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9729 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9730 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9731 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9732 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9733 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9734 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9735 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9736 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9737 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9738 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9739 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9740 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9741 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9742 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9743 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9744 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9745 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9746 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9747 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9748 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9749 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9750 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9751 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9752 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9753 | 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] | 9754 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9755 | 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] | 9756 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9757 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9758 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9759 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9760 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9761 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9762 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9763 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9764 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9765 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9766 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9767 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9768 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9769 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9770 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9771 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9772 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9773 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9774 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9775 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9776 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9777 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9778 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9779 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9780 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9781 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9782 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9783 | {} |
| 9784 | }; |
| 9785 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9786 | /* codec SSID table for Intel Mac */ |
| 9787 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9788 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9789 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9790 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9791 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9792 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9793 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9794 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9795 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9796 | 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] | 9797 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9798 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9799 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9800 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9801 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9802 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9803 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9804 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9805 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9806 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9807 | */ |
| 9808 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9809 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9810 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9811 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9812 | }; |
| 9813 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9814 | static struct alc_config_preset alc882_presets[] = { |
| 9815 | [ALC882_3ST_DIG] = { |
| 9816 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9817 | .init_verbs = { alc882_base_init_verbs, |
| 9818 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9819 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9820 | .dac_nids = alc882_dac_nids, |
| 9821 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9822 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9823 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9824 | .channel_mode = alc882_ch_modes, |
| 9825 | .need_dac_fix = 1, |
| 9826 | .input_mux = &alc882_capture_source, |
| 9827 | }, |
| 9828 | [ALC882_6ST_DIG] = { |
| 9829 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9830 | .init_verbs = { alc882_base_init_verbs, |
| 9831 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9832 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9833 | .dac_nids = alc882_dac_nids, |
| 9834 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9835 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9836 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9837 | .channel_mode = alc882_sixstack_modes, |
| 9838 | .input_mux = &alc882_capture_source, |
| 9839 | }, |
| 9840 | [ALC882_ARIMA] = { |
| 9841 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9842 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9843 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9844 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9845 | .dac_nids = alc882_dac_nids, |
| 9846 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9847 | .channel_mode = alc882_sixstack_modes, |
| 9848 | .input_mux = &alc882_capture_source, |
| 9849 | }, |
| 9850 | [ALC882_W2JC] = { |
| 9851 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9852 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9853 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9854 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9855 | .dac_nids = alc882_dac_nids, |
| 9856 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9857 | .channel_mode = alc880_threestack_modes, |
| 9858 | .need_dac_fix = 1, |
| 9859 | .input_mux = &alc882_capture_source, |
| 9860 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9861 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9862 | [ALC885_MBA21] = { |
| 9863 | .mixers = { alc885_mba21_mixer }, |
| 9864 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9865 | .num_dacs = 2, |
| 9866 | .dac_nids = alc882_dac_nids, |
| 9867 | .channel_mode = alc885_mba21_ch_modes, |
| 9868 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9869 | .input_mux = &alc882_capture_source, |
| 9870 | .unsol_event = alc_automute_amp_unsol_event, |
| 9871 | .setup = alc885_mba21_setup, |
| 9872 | .init_hook = alc_automute_amp, |
| 9873 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9874 | [ALC885_MBP3] = { |
| 9875 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9876 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9877 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9878 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9879 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9880 | .hp_nid = 0x04, |
| 9881 | .channel_mode = alc885_mbp_4ch_modes, |
| 9882 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9883 | .input_mux = &alc882_capture_source, |
| 9884 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9885 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9886 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9887 | .setup = alc885_mbp3_setup, |
| 9888 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9889 | }, |
| 9890 | [ALC885_MB5] = { |
| 9891 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9892 | .init_verbs = { alc885_mb5_init_verbs, |
| 9893 | alc880_gpio1_init_verbs }, |
| 9894 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9895 | .dac_nids = alc882_dac_nids, |
| 9896 | .channel_mode = alc885_mb5_6ch_modes, |
| 9897 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9898 | .input_mux = &mb5_capture_source, |
| 9899 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9900 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9901 | .unsol_event = alc_automute_amp_unsol_event, |
| 9902 | .setup = alc885_mb5_setup, |
| 9903 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9904 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9905 | [ALC885_MACMINI3] = { |
| 9906 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9907 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9908 | alc880_gpio1_init_verbs }, |
| 9909 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9910 | .dac_nids = alc882_dac_nids, |
| 9911 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9912 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9913 | .input_mux = &macmini3_capture_source, |
| 9914 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9915 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9916 | .unsol_event = alc_automute_amp_unsol_event, |
| 9917 | .setup = alc885_macmini3_setup, |
| 9918 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9919 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9920 | [ALC885_MACPRO] = { |
| 9921 | .mixers = { alc882_macpro_mixer }, |
| 9922 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9923 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9924 | .dac_nids = alc882_dac_nids, |
| 9925 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9926 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9927 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9928 | .channel_mode = alc882_ch_modes, |
| 9929 | .input_mux = &alc882_capture_source, |
| 9930 | .init_hook = alc885_macpro_init_hook, |
| 9931 | }, |
| 9932 | [ALC885_IMAC24] = { |
| 9933 | .mixers = { alc885_imac24_mixer }, |
| 9934 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9935 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9936 | .dac_nids = alc882_dac_nids, |
| 9937 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9938 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9939 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9940 | .channel_mode = alc882_ch_modes, |
| 9941 | .input_mux = &alc882_capture_source, |
| 9942 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9943 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9944 | .init_hook = alc885_imac24_init_hook, |
| 9945 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9946 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9947 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9948 | .init_verbs = { alc885_imac91_init_verbs, |
| 9949 | alc880_gpio1_init_verbs }, |
| 9950 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9951 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9952 | .channel_mode = alc885_mba21_ch_modes, |
| 9953 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9954 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9955 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9956 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9957 | .unsol_event = alc_automute_amp_unsol_event, |
| 9958 | .setup = alc885_imac91_setup, |
| 9959 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9960 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9961 | [ALC882_TARGA] = { |
| 9962 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9963 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9964 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9965 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9966 | .dac_nids = alc882_dac_nids, |
| 9967 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9968 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9969 | .adc_nids = alc882_adc_nids, |
| 9970 | .capsrc_nids = alc882_capsrc_nids, |
| 9971 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9972 | .channel_mode = alc882_3ST_6ch_modes, |
| 9973 | .need_dac_fix = 1, |
| 9974 | .input_mux = &alc882_capture_source, |
| 9975 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9976 | .setup = alc882_targa_setup, |
| 9977 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9978 | }, |
| 9979 | [ALC882_ASUS_A7J] = { |
| 9980 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9981 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9982 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9983 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9984 | .dac_nids = alc882_dac_nids, |
| 9985 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9986 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9987 | .adc_nids = alc882_adc_nids, |
| 9988 | .capsrc_nids = alc882_capsrc_nids, |
| 9989 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9990 | .channel_mode = alc882_3ST_6ch_modes, |
| 9991 | .need_dac_fix = 1, |
| 9992 | .input_mux = &alc882_capture_source, |
| 9993 | }, |
| 9994 | [ALC882_ASUS_A7M] = { |
| 9995 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9996 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9997 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9998 | alc882_asus_a7m_verbs }, |
| 9999 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10000 | .dac_nids = alc882_dac_nids, |
| 10001 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10002 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10003 | .channel_mode = alc880_threestack_modes, |
| 10004 | .need_dac_fix = 1, |
| 10005 | .input_mux = &alc882_capture_source, |
| 10006 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10007 | [ALC883_3ST_2ch_DIG] = { |
| 10008 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10009 | .init_verbs = { alc883_init_verbs }, |
| 10010 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10011 | .dac_nids = alc883_dac_nids, |
| 10012 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10013 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10014 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10015 | .channel_mode = alc883_3ST_2ch_modes, |
| 10016 | .input_mux = &alc883_capture_source, |
| 10017 | }, |
| 10018 | [ALC883_3ST_6ch_DIG] = { |
| 10019 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10020 | .init_verbs = { alc883_init_verbs }, |
| 10021 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10022 | .dac_nids = alc883_dac_nids, |
| 10023 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10024 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10025 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10026 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10027 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10028 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10029 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10030 | [ALC883_3ST_6ch] = { |
| 10031 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10032 | .init_verbs = { alc883_init_verbs }, |
| 10033 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10034 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10035 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10036 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10037 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10038 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10039 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10040 | [ALC883_3ST_6ch_INTEL] = { |
| 10041 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10042 | .init_verbs = { alc883_init_verbs }, |
| 10043 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10044 | .dac_nids = alc883_dac_nids, |
| 10045 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10046 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10047 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10048 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10049 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10050 | .need_dac_fix = 1, |
| 10051 | .input_mux = &alc883_3stack_6ch_intel, |
| 10052 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10053 | [ALC889A_INTEL] = { |
| 10054 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10055 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10056 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10057 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10058 | .dac_nids = alc883_dac_nids, |
| 10059 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10060 | .adc_nids = alc889_adc_nids, |
| 10061 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10062 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10063 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10064 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10065 | .channel_mode = alc889_8ch_intel_modes, |
| 10066 | .capsrc_nids = alc889_capsrc_nids, |
| 10067 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10068 | .setup = alc889_automute_setup, |
| 10069 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10070 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10071 | .need_dac_fix = 1, |
| 10072 | }, |
| 10073 | [ALC889_INTEL] = { |
| 10074 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10075 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10076 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10077 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10078 | .dac_nids = alc883_dac_nids, |
| 10079 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10080 | .adc_nids = alc889_adc_nids, |
| 10081 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10082 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10083 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10084 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10085 | .channel_mode = alc889_8ch_intel_modes, |
| 10086 | .capsrc_nids = alc889_capsrc_nids, |
| 10087 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10088 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10089 | .init_hook = alc889_intel_init_hook, |
| 10090 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10091 | .need_dac_fix = 1, |
| 10092 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10093 | [ALC883_6ST_DIG] = { |
| 10094 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10095 | .init_verbs = { alc883_init_verbs }, |
| 10096 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10097 | .dac_nids = alc883_dac_nids, |
| 10098 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10099 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10100 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10101 | .channel_mode = alc883_sixstack_modes, |
| 10102 | .input_mux = &alc883_capture_source, |
| 10103 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10104 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10105 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10106 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10107 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10108 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10109 | .dac_nids = alc883_dac_nids, |
| 10110 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10111 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10112 | .channel_mode = alc883_3ST_6ch_modes, |
| 10113 | .need_dac_fix = 1, |
| 10114 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10115 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10116 | .setup = alc882_targa_setup, |
| 10117 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10118 | }, |
| 10119 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10120 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10121 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10122 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10123 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10124 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10125 | .adc_nids = alc883_adc_nids_alt, |
| 10126 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10127 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10128 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10129 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10130 | .channel_mode = alc883_3ST_2ch_modes, |
| 10131 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10132 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10133 | .setup = alc882_targa_setup, |
| 10134 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10135 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10136 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10137 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10138 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10139 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10140 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10141 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10142 | .dac_nids = alc883_dac_nids, |
| 10143 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10144 | .adc_nids = alc883_adc_nids_rev, |
| 10145 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10146 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10147 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10148 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10149 | .channel_mode = alc883_4ST_8ch_modes, |
| 10150 | .need_dac_fix = 1, |
| 10151 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10152 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10153 | .setup = alc882_targa_setup, |
| 10154 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10155 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10156 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10157 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10158 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10159 | * and the headphone jack. Turn this on and rely on the |
| 10160 | * standard mute methods whenever the user wants to turn |
| 10161 | * these outputs off. |
| 10162 | */ |
| 10163 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10164 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10165 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10166 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10167 | .channel_mode = alc883_3ST_2ch_modes, |
| 10168 | .input_mux = &alc883_capture_source, |
| 10169 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10170 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10171 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10172 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10173 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10174 | .dac_nids = alc883_dac_nids, |
| 10175 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10176 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10177 | .channel_mode = alc883_3ST_2ch_modes, |
| 10178 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10179 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10180 | .setup = alc883_acer_aspire_setup, |
| 10181 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10182 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10183 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10184 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10185 | alc883_chmode_mixer }, |
| 10186 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10187 | alc888_acer_aspire_4930g_verbs }, |
| 10188 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10189 | .dac_nids = alc883_dac_nids, |
| 10190 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10191 | .adc_nids = alc883_adc_nids_rev, |
| 10192 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10193 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10194 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10195 | .channel_mode = alc883_3ST_6ch_modes, |
| 10196 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10197 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10198 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10199 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10200 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10201 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10202 | .setup = alc888_acer_aspire_4930g_setup, |
| 10203 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10204 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10205 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10206 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10207 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10208 | alc888_acer_aspire_6530g_verbs }, |
| 10209 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10210 | .dac_nids = alc883_dac_nids, |
| 10211 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10212 | .adc_nids = alc883_adc_nids_rev, |
| 10213 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10214 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10215 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10216 | .channel_mode = alc883_3ST_2ch_modes, |
| 10217 | .num_mux_defs = |
| 10218 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10219 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10220 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10221 | .setup = alc888_acer_aspire_6530g_setup, |
| 10222 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10223 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10224 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10225 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10226 | alc883_chmode_mixer }, |
| 10227 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10228 | alc889_acer_aspire_8930g_verbs, |
| 10229 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10230 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10231 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10232 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10233 | .adc_nids = alc889_adc_nids, |
| 10234 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10235 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10236 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10237 | .channel_mode = alc883_3ST_6ch_modes, |
| 10238 | .need_dac_fix = 1, |
| 10239 | .const_channel_count = 6, |
| 10240 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10241 | ARRAY_SIZE(alc889_capture_sources), |
| 10242 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10243 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10244 | .setup = alc889_acer_aspire_8930g_setup, |
| 10245 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10246 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10247 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10248 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10249 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10250 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10251 | .mixers = { alc883_3ST_6ch_mixer, |
| 10252 | alc883_chmode_mixer }, |
| 10253 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10254 | alc888_acer_aspire_7730G_verbs }, |
| 10255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10256 | .dac_nids = alc883_dac_nids, |
| 10257 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10258 | .adc_nids = alc883_adc_nids_rev, |
| 10259 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10260 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10261 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10262 | .channel_mode = alc883_3ST_6ch_modes, |
| 10263 | .need_dac_fix = 1, |
| 10264 | .const_channel_count = 6, |
| 10265 | .input_mux = &alc883_capture_source, |
| 10266 | .unsol_event = alc_automute_amp_unsol_event, |
| 10267 | .setup = alc888_acer_aspire_6530g_setup, |
| 10268 | .init_hook = alc_automute_amp, |
| 10269 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10270 | [ALC883_MEDION] = { |
| 10271 | .mixers = { alc883_fivestack_mixer, |
| 10272 | alc883_chmode_mixer }, |
| 10273 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10274 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10275 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10276 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10277 | .adc_nids = alc883_adc_nids_alt, |
| 10278 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10279 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10280 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10281 | .channel_mode = alc883_sixstack_modes, |
| 10282 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10283 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10284 | [ALC883_MEDION_MD2] = { |
| 10285 | .mixers = { alc883_medion_md2_mixer}, |
| 10286 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 10287 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10288 | .dac_nids = alc883_dac_nids, |
| 10289 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10290 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10291 | .channel_mode = alc883_3ST_2ch_modes, |
| 10292 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10293 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10294 | .setup = alc883_medion_md2_setup, |
| 10295 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10296 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10297 | [ALC883_MEDION_WIM2160] = { |
| 10298 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10299 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10300 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10301 | .dac_nids = alc883_dac_nids, |
| 10302 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10303 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10304 | .adc_nids = alc883_adc_nids, |
| 10305 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10306 | .channel_mode = alc883_3ST_2ch_modes, |
| 10307 | .input_mux = &alc883_capture_source, |
| 10308 | .unsol_event = alc_automute_amp_unsol_event, |
| 10309 | .setup = alc883_medion_wim2160_setup, |
| 10310 | .init_hook = alc_automute_amp, |
| 10311 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10312 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10313 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10314 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10315 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10316 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10317 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10318 | .channel_mode = alc883_3ST_2ch_modes, |
| 10319 | .input_mux = &alc883_capture_source, |
| 10320 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10321 | [ALC883_CLEVO_M540R] = { |
| 10322 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10323 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10324 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10325 | .dac_nids = alc883_dac_nids, |
| 10326 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10327 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10328 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10329 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10330 | .need_dac_fix = 1, |
| 10331 | .input_mux = &alc883_capture_source, |
| 10332 | /* This machine has the hardware HP auto-muting, thus |
| 10333 | * we need no software mute via unsol event |
| 10334 | */ |
| 10335 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10336 | [ALC883_CLEVO_M720] = { |
| 10337 | .mixers = { alc883_clevo_m720_mixer }, |
| 10338 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10339 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10340 | .dac_nids = alc883_dac_nids, |
| 10341 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10342 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10343 | .channel_mode = alc883_3ST_2ch_modes, |
| 10344 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10345 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10346 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10347 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10348 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10349 | [ALC883_LENOVO_101E_2ch] = { |
| 10350 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10351 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10352 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10353 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10354 | .adc_nids = alc883_adc_nids_alt, |
| 10355 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10356 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10357 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10358 | .channel_mode = alc883_3ST_2ch_modes, |
| 10359 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10360 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10361 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10362 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10363 | [ALC883_LENOVO_NB0763] = { |
| 10364 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10365 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10366 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10367 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10368 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10369 | .channel_mode = alc883_3ST_2ch_modes, |
| 10370 | .need_dac_fix = 1, |
| 10371 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10372 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10373 | .setup = alc883_medion_md2_setup, |
| 10374 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10375 | }, |
| 10376 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10377 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10378 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10379 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10380 | .dac_nids = alc883_dac_nids, |
| 10381 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10382 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10383 | .channel_mode = alc883_3ST_6ch_modes, |
| 10384 | .need_dac_fix = 1, |
| 10385 | .input_mux = &alc883_capture_source, |
| 10386 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10387 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10388 | }, |
| 10389 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10390 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10391 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10392 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10393 | .dac_nids = alc883_dac_nids, |
| 10394 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10395 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10396 | .channel_mode = alc883_3ST_2ch_modes, |
| 10397 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10398 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10399 | .setup = alc883_haier_w66_setup, |
| 10400 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10401 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10402 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10403 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10404 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10405 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10406 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10407 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10408 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10409 | .need_dac_fix = 1, |
| 10410 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10411 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10412 | .setup = alc888_3st_hp_setup, |
| 10413 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10414 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10415 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10416 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10417 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10418 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10419 | .dac_nids = alc883_dac_nids, |
| 10420 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10421 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10422 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10423 | .channel_mode = alc883_sixstack_modes, |
| 10424 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10425 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10426 | .setup = alc888_6st_dell_setup, |
| 10427 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10428 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10429 | [ALC883_MITAC] = { |
| 10430 | .mixers = { alc883_mitac_mixer }, |
| 10431 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10432 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10433 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10434 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10435 | .channel_mode = alc883_3ST_2ch_modes, |
| 10436 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10437 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10438 | .setup = alc883_mitac_setup, |
| 10439 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10440 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10441 | [ALC883_FUJITSU_PI2515] = { |
| 10442 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10443 | .init_verbs = { alc883_init_verbs, |
| 10444 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 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_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10451 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10452 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10453 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10454 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10455 | [ALC888_FUJITSU_XA3530] = { |
| 10456 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10457 | .init_verbs = { alc883_init_verbs, |
| 10458 | alc888_fujitsu_xa3530_verbs }, |
| 10459 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10460 | .dac_nids = alc883_dac_nids, |
| 10461 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10462 | .adc_nids = alc883_adc_nids_rev, |
| 10463 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10464 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10465 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10466 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10467 | .num_mux_defs = |
| 10468 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10469 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10470 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10471 | .setup = alc888_fujitsu_xa3530_setup, |
| 10472 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10473 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10474 | [ALC888_LENOVO_SKY] = { |
| 10475 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10476 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10477 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10478 | .dac_nids = alc883_dac_nids, |
| 10479 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10480 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10481 | .channel_mode = alc883_sixstack_modes, |
| 10482 | .need_dac_fix = 1, |
| 10483 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10484 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10485 | .setup = alc888_lenovo_sky_setup, |
| 10486 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10487 | }, |
| 10488 | [ALC888_ASUS_M90V] = { |
| 10489 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10490 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10491 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10492 | .dac_nids = alc883_dac_nids, |
| 10493 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10494 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10495 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10496 | .channel_mode = alc883_3ST_6ch_modes, |
| 10497 | .need_dac_fix = 1, |
| 10498 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10499 | .unsol_event = alc_sku_unsol_event, |
| 10500 | .setup = alc883_mode2_setup, |
| 10501 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10502 | }, |
| 10503 | [ALC888_ASUS_EEE1601] = { |
| 10504 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10505 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10506 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10507 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10508 | .dac_nids = alc883_dac_nids, |
| 10509 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10510 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10511 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10512 | .channel_mode = alc883_3ST_2ch_modes, |
| 10513 | .need_dac_fix = 1, |
| 10514 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10515 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10516 | .init_hook = alc883_eee1601_inithook, |
| 10517 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10518 | [ALC1200_ASUS_P5Q] = { |
| 10519 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10520 | .init_verbs = { alc883_init_verbs }, |
| 10521 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10522 | .dac_nids = alc883_dac_nids, |
| 10523 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10524 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10525 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10526 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10527 | .channel_mode = alc883_sixstack_modes, |
| 10528 | .input_mux = &alc883_capture_source, |
| 10529 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10530 | [ALC889A_MB31] = { |
| 10531 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10532 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10533 | alc880_gpio1_init_verbs }, |
| 10534 | .adc_nids = alc883_adc_nids, |
| 10535 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10536 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10537 | .dac_nids = alc883_dac_nids, |
| 10538 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10539 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10540 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10541 | .input_mux = &alc889A_mb31_capture_source, |
| 10542 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10543 | .unsol_event = alc889A_mb31_unsol_event, |
| 10544 | .init_hook = alc889A_mb31_automute, |
| 10545 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10546 | [ALC883_SONY_VAIO_TT] = { |
| 10547 | .mixers = { alc883_vaiott_mixer }, |
| 10548 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10549 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10550 | .dac_nids = alc883_dac_nids, |
| 10551 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10552 | .channel_mode = alc883_3ST_2ch_modes, |
| 10553 | .input_mux = &alc883_capture_source, |
| 10554 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10555 | .setup = alc883_vaiott_setup, |
| 10556 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10557 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10558 | }; |
| 10559 | |
| 10560 | |
| 10561 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10562 | * Pin config fixes |
| 10563 | */ |
| 10564 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10565 | PINFIX_ABIT_AW9D_MAX, |
| 10566 | PINFIX_PB_M5210, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10567 | }; |
| 10568 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10569 | static const struct alc_fixup alc882_fixups[] = { |
| 10570 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10571 | .pins = (const struct alc_pincfg[]) { |
| 10572 | { 0x15, 0x01080104 }, /* side */ |
| 10573 | { 0x16, 0x01011012 }, /* rear */ |
| 10574 | { 0x17, 0x01016011 }, /* clfe */ |
| 10575 | { } |
| 10576 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10577 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10578 | [PINFIX_PB_M5210] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10579 | .verbs = (const struct hda_verb[]) { |
| 10580 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10581 | {} |
| 10582 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10583 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10584 | }; |
| 10585 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10586 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10587 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10588 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10589 | {} |
| 10590 | }; |
| 10591 | |
| 10592 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10593 | * BIOS auto configuration |
| 10594 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10595 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10596 | const struct auto_pin_cfg *cfg) |
| 10597 | { |
| 10598 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10599 | } |
| 10600 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10601 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10602 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10603 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10604 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10605 | int idx; |
| 10606 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10607 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10608 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10609 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10610 | if (dac == 0x25) |
| 10611 | idx = 4; |
| 10612 | else if (dac >= 0x02 && dac <= 0x05) |
| 10613 | idx = dac - 2; |
| 10614 | else |
| 10615 | return; |
| 10616 | 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] | 10617 | } |
| 10618 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10619 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10620 | { |
| 10621 | struct alc_spec *spec = codec->spec; |
| 10622 | int i; |
| 10623 | |
| 10624 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10625 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10626 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10627 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10628 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10629 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10630 | } |
| 10631 | } |
| 10632 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10633 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10634 | { |
| 10635 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10636 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10637 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10638 | |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10639 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10640 | pin = spec->autocfg.hp_pins[i]; |
| 10641 | if (!pin) |
| 10642 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10643 | dac = spec->multiout.hp_nid; |
| 10644 | if (!dac) |
| 10645 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10646 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10647 | } |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10648 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10649 | pin = spec->autocfg.speaker_pins[i]; |
| 10650 | if (!pin) |
| 10651 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10652 | dac = spec->multiout.extra_out_nid[0]; |
| 10653 | if (!dac) |
| 10654 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10655 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10656 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10657 | } |
| 10658 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10659 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10660 | { |
| 10661 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10662 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10663 | int i; |
| 10664 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10665 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10666 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame^] | 10667 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10668 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10669 | snd_hda_codec_write(codec, nid, 0, |
| 10670 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10671 | AMP_OUT_MUTE); |
| 10672 | } |
| 10673 | } |
| 10674 | |
| 10675 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10676 | { |
| 10677 | struct alc_spec *spec = codec->spec; |
| 10678 | int c; |
| 10679 | |
| 10680 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10681 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10682 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10683 | unsigned int mux_idx; |
| 10684 | const struct hda_input_mux *imux; |
| 10685 | int conns, mute, idx, item; |
| 10686 | |
| 10687 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10688 | ARRAY_SIZE(conn_list)); |
| 10689 | if (conns < 0) |
| 10690 | continue; |
| 10691 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10692 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10693 | if (!imux->num_items && mux_idx > 0) |
| 10694 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10695 | for (idx = 0; idx < conns; idx++) { |
| 10696 | /* if the current connection is the selected one, |
| 10697 | * unmute it as default - otherwise mute it |
| 10698 | */ |
| 10699 | mute = AMP_IN_MUTE(idx); |
| 10700 | for (item = 0; item < imux->num_items; item++) { |
| 10701 | if (imux->items[item].index == idx) { |
| 10702 | if (spec->cur_mux[c] == item) |
| 10703 | mute = AMP_IN_UNMUTE(idx); |
| 10704 | break; |
| 10705 | } |
| 10706 | } |
| 10707 | /* check if we have a selector or mixer |
| 10708 | * we could check for the widget type instead, but |
| 10709 | * just check for Amp-In presence (in case of mixer |
| 10710 | * without amp-in there is something wrong, this |
| 10711 | * function shouldn't be used or capsrc nid is wrong) |
| 10712 | */ |
| 10713 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10714 | snd_hda_codec_write(codec, nid, 0, |
| 10715 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10716 | mute); |
| 10717 | else if (mute != AMP_IN_MUTE(idx)) |
| 10718 | snd_hda_codec_write(codec, nid, 0, |
| 10719 | AC_VERB_SET_CONNECT_SEL, |
| 10720 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10721 | } |
| 10722 | } |
| 10723 | } |
| 10724 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10725 | /* add mic boosts if needed */ |
| 10726 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10727 | { |
| 10728 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10729 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 10730 | int i, err; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10731 | hda_nid_t nid; |
| 10732 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10733 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10734 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10735 | break; |
| 10736 | nid = cfg->inputs[i].pin; |
| 10737 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 10738 | char label[32]; |
| 10739 | snprintf(label, sizeof(label), "%s Boost", |
| 10740 | hda_get_autocfg_input_label(codec, cfg, i)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10741 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10742 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10743 | if (err < 0) |
| 10744 | return err; |
| 10745 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10746 | } |
| 10747 | return 0; |
| 10748 | } |
| 10749 | |
| 10750 | /* almost identical with ALC880 parser... */ |
| 10751 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10752 | { |
| 10753 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10754 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10755 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10756 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10757 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10758 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10759 | if (err < 0) |
| 10760 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10761 | if (!spec->autocfg.line_outs) |
| 10762 | return 0; /* can't find valid BIOS pin config */ |
| 10763 | |
| 10764 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10765 | if (err < 0) |
| 10766 | return err; |
| 10767 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10768 | if (err < 0) |
| 10769 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10770 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10771 | "Headphone"); |
| 10772 | if (err < 0) |
| 10773 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10774 | err = alc880_auto_create_extra_out(spec, |
| 10775 | spec->autocfg.speaker_pins[0], |
| 10776 | "Speaker"); |
| 10777 | if (err < 0) |
| 10778 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10779 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10780 | if (err < 0) |
| 10781 | return err; |
| 10782 | |
| 10783 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10784 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10785 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10786 | |
| 10787 | if (spec->kctls.list) |
| 10788 | add_mixer(spec, spec->kctls.list); |
| 10789 | |
| 10790 | add_verb(spec, alc883_auto_init_verbs); |
| 10791 | /* if ADC 0x07 is available, initialize it, too */ |
| 10792 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10793 | add_verb(spec, alc882_adc1_init_verbs); |
| 10794 | |
| 10795 | spec->num_mux_defs = 1; |
| 10796 | spec->input_mux = &spec->private_imux[0]; |
| 10797 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10798 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10799 | |
| 10800 | err = alc_auto_add_mic_boost(codec); |
| 10801 | if (err < 0) |
| 10802 | return err; |
| 10803 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10804 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10805 | } |
| 10806 | |
| 10807 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10808 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10809 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10810 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10811 | alc882_auto_init_multi_out(codec); |
| 10812 | alc882_auto_init_hp_out(codec); |
| 10813 | alc882_auto_init_analog_input(codec); |
| 10814 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10815 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10816 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10817 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10818 | } |
| 10819 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10820 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10821 | { |
| 10822 | struct alc_spec *spec; |
| 10823 | int err, board_config; |
| 10824 | |
| 10825 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10826 | if (spec == NULL) |
| 10827 | return -ENOMEM; |
| 10828 | |
| 10829 | codec->spec = spec; |
| 10830 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10831 | alc_auto_parse_customize_define(codec); |
| 10832 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10833 | switch (codec->vendor_id) { |
| 10834 | case 0x10ec0882: |
| 10835 | case 0x10ec0885: |
| 10836 | break; |
| 10837 | default: |
| 10838 | /* ALC883 and variants */ |
| 10839 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10840 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10841 | } |
| 10842 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10843 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10844 | alc882_models, |
| 10845 | alc882_cfg_tbl); |
| 10846 | |
| 10847 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10848 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10849 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10850 | |
| 10851 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10852 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10853 | codec->chip_name); |
| 10854 | board_config = ALC882_AUTO; |
| 10855 | } |
| 10856 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10857 | if (board_config == ALC882_AUTO) |
| 10858 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10859 | |
| 10860 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10861 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10862 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10863 | if (err < 0) { |
| 10864 | alc_free(codec); |
| 10865 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10866 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10867 | printk(KERN_INFO |
| 10868 | "hda_codec: Cannot set up configuration " |
| 10869 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10870 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10871 | } |
| 10872 | } |
| 10873 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10874 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10875 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10876 | if (err < 0) { |
| 10877 | alc_free(codec); |
| 10878 | return err; |
| 10879 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10880 | } |
| 10881 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10882 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10883 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10884 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10885 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10886 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10887 | /* FIXME: setup DAC5 */ |
| 10888 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10889 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10890 | |
| 10891 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10892 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10893 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10894 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10895 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10896 | spec->num_adc_nids = 0; |
| 10897 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10898 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10899 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10900 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10901 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10902 | unsigned int wcap = get_wcaps(codec, nid); |
| 10903 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10904 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10905 | if (wcap != AC_WID_AUD_IN) |
| 10906 | continue; |
| 10907 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10908 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10909 | if (err < 0) |
| 10910 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10911 | err = snd_hda_get_connections(codec, cap, items, |
| 10912 | ARRAY_SIZE(items)); |
| 10913 | if (err < 0) |
| 10914 | continue; |
| 10915 | for (j = 0; j < imux->num_items; j++) |
| 10916 | if (imux->items[j].index >= err) |
| 10917 | break; |
| 10918 | if (j < imux->num_items) |
| 10919 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10920 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10921 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10922 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10923 | spec->adc_nids = spec->private_adc_nids; |
| 10924 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10925 | } |
| 10926 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10927 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10928 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10929 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10930 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10931 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10932 | if (board_config == ALC882_AUTO) |
| 10933 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10934 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10935 | spec->vmaster_nid = 0x0c; |
| 10936 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10937 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10938 | if (board_config == ALC882_AUTO) |
| 10939 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10940 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10941 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10942 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10943 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10944 | |
| 10945 | return 0; |
| 10946 | } |
| 10947 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10948 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10949 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10950 | * ALC262 support |
| 10951 | */ |
| 10952 | |
| 10953 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10954 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10955 | |
| 10956 | #define alc262_dac_nids alc260_dac_nids |
| 10957 | #define alc262_adc_nids alc882_adc_nids |
| 10958 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10959 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10960 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10961 | |
| 10962 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10963 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10964 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10965 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10966 | /* ADC0 */ |
| 10967 | 0x09 |
| 10968 | }; |
| 10969 | |
| 10970 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10971 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10972 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10973 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10974 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10975 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10976 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10977 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10978 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10981 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10982 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10983 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10984 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10985 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10986 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10987 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10988 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10989 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10990 | }; |
| 10991 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10992 | /* update HP, line and mono-out pins according to the master switch */ |
| 10993 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10994 | { |
| 10995 | struct alc_spec *spec = codec->spec; |
| 10996 | int val = spec->master_sw; |
| 10997 | |
| 10998 | /* HP & line-out */ |
| 10999 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11000 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11001 | val ? PIN_HP : 0); |
| 11002 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11003 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11004 | val ? PIN_HP : 0); |
| 11005 | /* mono (speaker) depending on the HP jack sense */ |
| 11006 | val = val && !spec->jack_present; |
| 11007 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11008 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11009 | val ? PIN_OUT : 0); |
| 11010 | } |
| 11011 | |
| 11012 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11013 | { |
| 11014 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11015 | |
| 11016 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11017 | alc262_hp_master_update(codec); |
| 11018 | } |
| 11019 | |
| 11020 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11021 | { |
| 11022 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11023 | return; |
| 11024 | alc262_hp_bpc_automute(codec); |
| 11025 | } |
| 11026 | |
| 11027 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11028 | { |
| 11029 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11030 | |
| 11031 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11032 | alc262_hp_master_update(codec); |
| 11033 | } |
| 11034 | |
| 11035 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11036 | unsigned int res) |
| 11037 | { |
| 11038 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11039 | return; |
| 11040 | alc262_hp_wildwest_automute(codec); |
| 11041 | } |
| 11042 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11043 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11044 | |
| 11045 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11046 | struct snd_ctl_elem_value *ucontrol) |
| 11047 | { |
| 11048 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11049 | struct alc_spec *spec = codec->spec; |
| 11050 | int val = !!*ucontrol->value.integer.value; |
| 11051 | |
| 11052 | if (val == spec->master_sw) |
| 11053 | return 0; |
| 11054 | spec->master_sw = val; |
| 11055 | alc262_hp_master_update(codec); |
| 11056 | return 1; |
| 11057 | } |
| 11058 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11059 | #define ALC262_HP_MASTER_SWITCH \ |
| 11060 | { \ |
| 11061 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11062 | .name = "Master Playback Switch", \ |
| 11063 | .info = snd_ctl_boolean_mono_info, \ |
| 11064 | .get = alc262_hp_master_sw_get, \ |
| 11065 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11066 | }, \ |
| 11067 | { \ |
| 11068 | .iface = NID_MAPPING, \ |
| 11069 | .name = "Master Playback Switch", \ |
| 11070 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11071 | } |
| 11072 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11073 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11074 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11075 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11076 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11077 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11078 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11079 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11080 | HDA_OUTPUT), |
| 11081 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11082 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11084 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11085 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11086 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11087 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11088 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11089 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11090 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11091 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11092 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11093 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11094 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11095 | { } /* end */ |
| 11096 | }; |
| 11097 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11098 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11099 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11100 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11101 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11102 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11103 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11104 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11105 | HDA_OUTPUT), |
| 11106 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11107 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11108 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11109 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11110 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11111 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11112 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11113 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11114 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11115 | { } /* end */ |
| 11116 | }; |
| 11117 | |
| 11118 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11119 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11120 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11121 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11122 | { } /* end */ |
| 11123 | }; |
| 11124 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11125 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11126 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11127 | { |
| 11128 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11129 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11130 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11131 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11132 | } |
| 11133 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11134 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11135 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11136 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11137 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11138 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11139 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11140 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11141 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11142 | { } /* end */ |
| 11143 | }; |
| 11144 | |
| 11145 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11146 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11147 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11148 | |
| 11149 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11150 | { } |
| 11151 | }; |
| 11152 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11153 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11154 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11155 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11156 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11157 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11159 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11160 | { } /* end */ |
| 11161 | }; |
| 11162 | |
| 11163 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11164 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11165 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11166 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11167 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11168 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11169 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11170 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11171 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11174 | {} |
| 11175 | }; |
| 11176 | |
| 11177 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11178 | .num_items = 1, |
| 11179 | .items = { |
| 11180 | { "Line", 0x1 }, |
| 11181 | }, |
| 11182 | }; |
| 11183 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11184 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11185 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11186 | { |
| 11187 | struct alc_spec *spec = codec->spec; |
| 11188 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11189 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11190 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11191 | unsigned int mute; |
| 11192 | |
| 11193 | /* HP */ |
| 11194 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11195 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11196 | HDA_AMP_MUTE, mute); |
| 11197 | /* mute internal speaker per jack sense */ |
| 11198 | if (spec->jack_present) |
| 11199 | mute = HDA_AMP_MUTE; |
| 11200 | if (line_nid) |
| 11201 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11202 | HDA_AMP_MUTE, mute); |
| 11203 | if (speaker_nid && speaker_nid != line_nid) |
| 11204 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11205 | HDA_AMP_MUTE, mute); |
| 11206 | } |
| 11207 | |
| 11208 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11209 | |
| 11210 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11211 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11212 | { |
| 11213 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11214 | struct alc_spec *spec = codec->spec; |
| 11215 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11216 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11217 | if (val == spec->master_sw) |
| 11218 | return 0; |
| 11219 | spec->master_sw = val; |
| 11220 | alc262_hippo_master_update(codec); |
| 11221 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11222 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11223 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11224 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11225 | { \ |
| 11226 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11227 | .name = "Master Playback Switch", \ |
| 11228 | .info = snd_ctl_boolean_mono_info, \ |
| 11229 | .get = alc262_hippo_master_sw_get, \ |
| 11230 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11231 | }, \ |
| 11232 | { \ |
| 11233 | .iface = NID_MAPPING, \ |
| 11234 | .name = "Master Playback Switch", \ |
| 11235 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11236 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11237 | } |
| 11238 | |
| 11239 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11240 | ALC262_HIPPO_MASTER_SWITCH, |
| 11241 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11242 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11243 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11244 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11245 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11247 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11248 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11249 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11250 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11251 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11252 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11253 | { } /* end */ |
| 11254 | }; |
| 11255 | |
| 11256 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11257 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11258 | ALC262_HIPPO_MASTER_SWITCH, |
| 11259 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11260 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11261 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11262 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11265 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11266 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11267 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11268 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11269 | { } /* end */ |
| 11270 | }; |
| 11271 | |
| 11272 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11273 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11274 | { |
| 11275 | struct alc_spec *spec = codec->spec; |
| 11276 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11277 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11278 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11279 | alc262_hippo_master_update(codec); |
| 11280 | } |
| 11281 | |
| 11282 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11283 | { |
| 11284 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11285 | return; |
| 11286 | alc262_hippo_automute(codec); |
| 11287 | } |
| 11288 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11289 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11290 | { |
| 11291 | struct alc_spec *spec = codec->spec; |
| 11292 | |
| 11293 | spec->autocfg.hp_pins[0] = 0x15; |
| 11294 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11295 | } |
| 11296 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11297 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11298 | { |
| 11299 | struct alc_spec *spec = codec->spec; |
| 11300 | |
| 11301 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11302 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11303 | } |
| 11304 | |
| 11305 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11306 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11307 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11308 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11309 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11310 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11311 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11312 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11313 | { } /* end */ |
| 11314 | }; |
| 11315 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11316 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11317 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11318 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11319 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11320 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11321 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11322 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11323 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11324 | { } /* end */ |
| 11325 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11326 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11327 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11328 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11329 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11330 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11331 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11333 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11336 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11337 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11338 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11339 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11340 | { } /* end */ |
| 11341 | }; |
| 11342 | |
| 11343 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11344 | /* Headphone automute */ |
| 11345 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11346 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11347 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11348 | |
| 11349 | /* P11 AUX_IN, white 4-pin connector */ |
| 11350 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11351 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11352 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11353 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11354 | |
| 11355 | {} |
| 11356 | }; |
| 11357 | |
| 11358 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11359 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11360 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11361 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11362 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11363 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11364 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11365 | } |
| 11366 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11367 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11368 | #define alc262_capture_mixer alc882_capture_mixer |
| 11369 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11370 | |
| 11371 | /* |
| 11372 | * generic initialization of ADC, input mixers and output mixers |
| 11373 | */ |
| 11374 | static struct hda_verb alc262_init_verbs[] = { |
| 11375 | /* |
| 11376 | * Unmute ADC0-2 and set the default input to mic-in |
| 11377 | */ |
| 11378 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11379 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11380 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11381 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11382 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11383 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11384 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11385 | /* 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] | 11386 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11387 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11388 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11389 | */ |
| 11390 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11391 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11392 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11393 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11394 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11395 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11396 | |
| 11397 | /* |
| 11398 | * Set up output mixers (0x0c - 0x0e) |
| 11399 | */ |
| 11400 | /* set vol=0 to output mixers */ |
| 11401 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11402 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11403 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11404 | /* set up input amps for analog loopback */ |
| 11405 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11406 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11407 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11408 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11409 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11410 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11411 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11412 | |
| 11413 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11414 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11415 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11416 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11417 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11418 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11419 | |
| 11420 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11421 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11422 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11423 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11424 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11425 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11426 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11427 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11428 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11429 | /* FIXME: use matrix-type input source selection */ |
| 11430 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11431 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11432 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11433 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11434 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11435 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11436 | /* Input mixer2 */ |
| 11437 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11438 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11439 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11440 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11441 | /* Input mixer3 */ |
| 11442 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11443 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11444 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11445 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11446 | |
| 11447 | { } |
| 11448 | }; |
| 11449 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11450 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11451 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11452 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11453 | { } |
| 11454 | }; |
| 11455 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11456 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11457 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11458 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11459 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11460 | |
| 11461 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11462 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11463 | {} |
| 11464 | }; |
| 11465 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11466 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11468 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11469 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11470 | |
| 11471 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11472 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11473 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11474 | }; |
| 11475 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11476 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11477 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11478 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11479 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11480 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11481 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11482 | { } /* end */ |
| 11483 | }; |
| 11484 | |
| 11485 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11486 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11487 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11488 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11489 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11490 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11491 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11492 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11493 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11494 | {} |
| 11495 | }; |
| 11496 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11497 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11498 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11499 | struct alc_spec *spec = codec->spec; |
| 11500 | |
| 11501 | spec->autocfg.hp_pins[0] = 0x15; |
| 11502 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11503 | spec->ext_mic.pin = 0x18; |
| 11504 | spec->ext_mic.mux_idx = 0; |
| 11505 | spec->int_mic.pin = 0x12; |
| 11506 | spec->int_mic.mux_idx = 9; |
| 11507 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11508 | } |
| 11509 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11510 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11511 | * nec model |
| 11512 | * 0x15 = headphone |
| 11513 | * 0x16 = internal speaker |
| 11514 | * 0x18 = external mic |
| 11515 | */ |
| 11516 | |
| 11517 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11518 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11519 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11520 | |
| 11521 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11522 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11523 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11524 | |
| 11525 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11526 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11527 | { } /* end */ |
| 11528 | }; |
| 11529 | |
| 11530 | static struct hda_verb alc262_nec_verbs[] = { |
| 11531 | /* Unmute Speaker */ |
| 11532 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11533 | |
| 11534 | /* Headphone */ |
| 11535 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11536 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11537 | |
| 11538 | /* External mic to headphone */ |
| 11539 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11540 | /* External mic to speaker */ |
| 11541 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11542 | {} |
| 11543 | }; |
| 11544 | |
| 11545 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11546 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11547 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11548 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11549 | */ |
| 11550 | |
| 11551 | #define ALC_HP_EVENT 0x37 |
| 11552 | |
| 11553 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11554 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11555 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11556 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11557 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11558 | {} |
| 11559 | }; |
| 11560 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11561 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11562 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11563 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11564 | {} |
| 11565 | }; |
| 11566 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11567 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11568 | /* Front Mic pin: input vref at 50% */ |
| 11569 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11570 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11571 | {} |
| 11572 | }; |
| 11573 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11574 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11575 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11576 | .items = { |
| 11577 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11578 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11579 | { "CD", 0x4 }, |
| 11580 | }, |
| 11581 | }; |
| 11582 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11583 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11584 | .num_items = 5, |
| 11585 | .items = { |
| 11586 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11587 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11588 | { "Line", 0x2 }, |
| 11589 | { "CD", 0x4 }, |
| 11590 | { "AUX IN", 0x6 }, |
| 11591 | }, |
| 11592 | }; |
| 11593 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11594 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11595 | .num_items = 4, |
| 11596 | .items = { |
| 11597 | { "Mic", 0x0 }, |
| 11598 | { "Front Mic", 0x2 }, |
| 11599 | { "Line", 0x1 }, |
| 11600 | { "CD", 0x4 }, |
| 11601 | }, |
| 11602 | }; |
| 11603 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11604 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11605 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11606 | { |
| 11607 | struct alc_spec *spec = codec->spec; |
| 11608 | unsigned int mute; |
| 11609 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11610 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11611 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11612 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11613 | spec->sense_updated = 1; |
| 11614 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11615 | /* unmute internal speaker only if both HPs are unplugged and |
| 11616 | * master switch is on |
| 11617 | */ |
| 11618 | if (spec->jack_present) |
| 11619 | mute = HDA_AMP_MUTE; |
| 11620 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11621 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11622 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11623 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11624 | } |
| 11625 | |
| 11626 | /* unsolicited event for HP jack sensing */ |
| 11627 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11628 | unsigned int res) |
| 11629 | { |
| 11630 | if ((res >> 26) != ALC_HP_EVENT) |
| 11631 | return; |
| 11632 | alc262_fujitsu_automute(codec, 1); |
| 11633 | } |
| 11634 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11635 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11636 | { |
| 11637 | alc262_fujitsu_automute(codec, 1); |
| 11638 | } |
| 11639 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11640 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11641 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11642 | .ops = &snd_hda_bind_vol, |
| 11643 | .values = { |
| 11644 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11645 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11646 | 0 |
| 11647 | }, |
| 11648 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11649 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11650 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11651 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11652 | { |
| 11653 | struct alc_spec *spec = codec->spec; |
| 11654 | unsigned int mute; |
| 11655 | |
| 11656 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11657 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11658 | spec->sense_updated = 1; |
| 11659 | } |
| 11660 | if (spec->jack_present) { |
| 11661 | /* mute internal speaker */ |
| 11662 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11663 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11664 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11665 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11666 | } else { |
| 11667 | /* unmute internal speaker if necessary */ |
| 11668 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11669 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11670 | HDA_AMP_MUTE, mute); |
| 11671 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11672 | HDA_AMP_MUTE, mute); |
| 11673 | } |
| 11674 | } |
| 11675 | |
| 11676 | /* unsolicited event for HP jack sensing */ |
| 11677 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11678 | unsigned int res) |
| 11679 | { |
| 11680 | if ((res >> 26) != ALC_HP_EVENT) |
| 11681 | return; |
| 11682 | alc262_lenovo_3000_automute(codec, 1); |
| 11683 | } |
| 11684 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11685 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11686 | int dir, int idx, long *valp) |
| 11687 | { |
| 11688 | int i, change = 0; |
| 11689 | |
| 11690 | for (i = 0; i < 2; i++, valp++) |
| 11691 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11692 | HDA_AMP_MUTE, |
| 11693 | *valp ? 0 : HDA_AMP_MUTE); |
| 11694 | return change; |
| 11695 | } |
| 11696 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11697 | /* bind hp and internal speaker mute (with plug check) */ |
| 11698 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11699 | struct snd_ctl_elem_value *ucontrol) |
| 11700 | { |
| 11701 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11702 | long *valp = ucontrol->value.integer.value; |
| 11703 | int change; |
| 11704 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11705 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11706 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11707 | if (change) |
| 11708 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11709 | return change; |
| 11710 | } |
| 11711 | |
| 11712 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11713 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11714 | { |
| 11715 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11716 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11717 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11718 | .info = snd_hda_mixer_amp_switch_info, |
| 11719 | .get = snd_hda_mixer_amp_switch_get, |
| 11720 | .put = alc262_fujitsu_master_sw_put, |
| 11721 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11722 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11723 | { |
| 11724 | .iface = NID_MAPPING, |
| 11725 | .name = "Master Playback Switch", |
| 11726 | .private_value = 0x1b, |
| 11727 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11728 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11729 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11730 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11733 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11734 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11735 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11736 | { } /* end */ |
| 11737 | }; |
| 11738 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11739 | /* bind hp and internal speaker mute (with plug check) */ |
| 11740 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11741 | struct snd_ctl_elem_value *ucontrol) |
| 11742 | { |
| 11743 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11744 | long *valp = ucontrol->value.integer.value; |
| 11745 | int change; |
| 11746 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11747 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11748 | if (change) |
| 11749 | alc262_lenovo_3000_automute(codec, 0); |
| 11750 | return change; |
| 11751 | } |
| 11752 | |
| 11753 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11754 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11755 | { |
| 11756 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11757 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11758 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11759 | .info = snd_hda_mixer_amp_switch_info, |
| 11760 | .get = snd_hda_mixer_amp_switch_get, |
| 11761 | .put = alc262_lenovo_3000_master_sw_put, |
| 11762 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11763 | }, |
| 11764 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11765 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11766 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11767 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11769 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11770 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11771 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11772 | { } /* end */ |
| 11773 | }; |
| 11774 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11775 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11776 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11777 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11778 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11779 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11780 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11781 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11782 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11783 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11784 | { } /* end */ |
| 11785 | }; |
| 11786 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11787 | /* additional init verbs for Benq laptops */ |
| 11788 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11789 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11790 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11791 | {} |
| 11792 | }; |
| 11793 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11794 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11795 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11796 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11797 | |
| 11798 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11799 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11800 | {} |
| 11801 | }; |
| 11802 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11803 | /* Samsung Q1 Ultra Vista model setup */ |
| 11804 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11805 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11806 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11809 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11810 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11811 | { } /* end */ |
| 11812 | }; |
| 11813 | |
| 11814 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11815 | /* output mixer */ |
| 11816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11818 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11819 | /* speaker */ |
| 11820 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11821 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11822 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11823 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11824 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11825 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11826 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11827 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11828 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11829 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11830 | /* internal mic */ |
| 11831 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11832 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11833 | /* ADC, choose mic */ |
| 11834 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11835 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11836 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11837 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11838 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11839 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11840 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11841 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11842 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11843 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11844 | {} |
| 11845 | }; |
| 11846 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11847 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11848 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11849 | { |
| 11850 | struct alc_spec *spec = codec->spec; |
| 11851 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11852 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11853 | mute = 0; |
| 11854 | /* auto-mute only when HP is used as HP */ |
| 11855 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11856 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11857 | if (spec->jack_present) |
| 11858 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11859 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11860 | /* mute/unmute internal speaker */ |
| 11861 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11862 | HDA_AMP_MUTE, mute); |
| 11863 | /* mute/unmute HP */ |
| 11864 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11865 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11866 | } |
| 11867 | |
| 11868 | /* unsolicited event for HP jack sensing */ |
| 11869 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11870 | unsigned int res) |
| 11871 | { |
| 11872 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11873 | return; |
| 11874 | alc262_ultra_automute(codec); |
| 11875 | } |
| 11876 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11877 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11878 | .num_items = 2, |
| 11879 | .items = { |
| 11880 | { "Mic", 0x1 }, |
| 11881 | { "Headphone", 0x7 }, |
| 11882 | }, |
| 11883 | }; |
| 11884 | |
| 11885 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11886 | struct snd_ctl_elem_value *ucontrol) |
| 11887 | { |
| 11888 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11889 | struct alc_spec *spec = codec->spec; |
| 11890 | int ret; |
| 11891 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11892 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11893 | if (!ret) |
| 11894 | return 0; |
| 11895 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11896 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11897 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11898 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11899 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11900 | return ret; |
| 11901 | } |
| 11902 | |
| 11903 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11904 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11905 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11906 | { |
| 11907 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11908 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11909 | .info = alc_mux_enum_info, |
| 11910 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11911 | .put = alc262_ultra_mux_enum_put, |
| 11912 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11913 | { |
| 11914 | .iface = NID_MAPPING, |
| 11915 | .name = "Capture Source", |
| 11916 | .private_value = 0x15, |
| 11917 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11918 | { } /* end */ |
| 11919 | }; |
| 11920 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11921 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11922 | * and thus it's bound with a different mixer. |
| 11923 | * This function returns which mixer amp should be used. |
| 11924 | */ |
| 11925 | static int alc262_check_volbit(hda_nid_t nid) |
| 11926 | { |
| 11927 | if (!nid) |
| 11928 | return 0; |
| 11929 | else if (nid == 0x16) |
| 11930 | return 2; |
| 11931 | else |
| 11932 | return 1; |
| 11933 | } |
| 11934 | |
| 11935 | 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] | 11936 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11937 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11938 | unsigned long val; |
| 11939 | int vbit; |
| 11940 | |
| 11941 | vbit = alc262_check_volbit(nid); |
| 11942 | if (!vbit) |
| 11943 | return 0; |
| 11944 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11945 | return 0; |
| 11946 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11947 | if (vbit == 2) |
| 11948 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11949 | else |
| 11950 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11951 | 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] | 11952 | } |
| 11953 | |
| 11954 | 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] | 11955 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11956 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11957 | unsigned long val; |
| 11958 | |
| 11959 | if (!nid) |
| 11960 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11961 | if (nid == 0x16) |
| 11962 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11963 | else |
| 11964 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11965 | 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] | 11966 | } |
| 11967 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11968 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11969 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11970 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11971 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11972 | const char *pfx; |
| 11973 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11974 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11975 | |
| 11976 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11977 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11978 | spec->multiout.dac_nids[0] = 2; |
| 11979 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11980 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11981 | pfx = "Master"; |
| 11982 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11983 | pfx = "Speaker"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11984 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) |
| 11985 | pfx = "Headphone"; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11986 | else |
| 11987 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11988 | for (i = 0; i < 2; i++) { |
| 11989 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 11990 | if (err < 0) |
| 11991 | return err; |
| 11992 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11993 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 11994 | "Speaker", i); |
| 11995 | if (err < 0) |
| 11996 | return err; |
| 11997 | } |
| 11998 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 11999 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12000 | "Headphone", i); |
| 12001 | if (err < 0) |
| 12002 | return err; |
| 12003 | } |
| 12004 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12005 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12006 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12007 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12008 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12009 | if (vbits == 1 || vbits == 2) |
| 12010 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12011 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12012 | for (i = 0; i < 2; i++) { |
| 12013 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12014 | &vbits, i); |
| 12015 | if (err < 0) |
| 12016 | return err; |
| 12017 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12018 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12019 | "Speaker", &vbits, i); |
| 12020 | if (err < 0) |
| 12021 | return err; |
| 12022 | } |
| 12023 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12024 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12025 | "Headphone", &vbits, i); |
| 12026 | if (err < 0) |
| 12027 | return err; |
| 12028 | } |
| 12029 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12030 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12031 | } |
| 12032 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12033 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12034 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12035 | |
| 12036 | /* |
| 12037 | * generic initialization of ADC, input mixers and output mixers |
| 12038 | */ |
| 12039 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12040 | /* |
| 12041 | * Unmute ADC0-2 and set the default input to mic-in |
| 12042 | */ |
| 12043 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12044 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12045 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12046 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12047 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12048 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12049 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12050 | /* 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] | 12051 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12052 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12053 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12054 | */ |
| 12055 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12056 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12057 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12058 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12060 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12061 | |
| 12062 | /* |
| 12063 | * Set up output mixers (0x0c - 0x0f) |
| 12064 | */ |
| 12065 | /* set vol=0 to output mixers */ |
| 12066 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12067 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12068 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12069 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12070 | /* set up input amps for analog loopback */ |
| 12071 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12072 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12073 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12074 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12075 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12076 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12077 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12078 | |
| 12079 | /* FIXME: use matrix-type input source selection */ |
| 12080 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12081 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12085 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12086 | /* Input mixer2 */ |
| 12087 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12088 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12089 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12090 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12091 | /* Input mixer3 */ |
| 12092 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12093 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12094 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12096 | |
| 12097 | { } |
| 12098 | }; |
| 12099 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12100 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12101 | /* |
| 12102 | * Unmute ADC0-2 and set the default input to mic-in |
| 12103 | */ |
| 12104 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12106 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12107 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12108 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12109 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12110 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12111 | /* 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] | 12112 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12113 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12114 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12115 | */ |
| 12116 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12120 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12123 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12124 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12125 | /* |
| 12126 | * Set up output mixers (0x0c - 0x0e) |
| 12127 | */ |
| 12128 | /* set vol=0 to output mixers */ |
| 12129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12132 | |
| 12133 | /* set up input amps for analog loopback */ |
| 12134 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12135 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12136 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12137 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12138 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12139 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12140 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12141 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12142 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12143 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12144 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12145 | |
| 12146 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12147 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12148 | |
| 12149 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12150 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12151 | |
| 12152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12153 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12154 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12155 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12156 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12157 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12158 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12159 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12160 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12161 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12162 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12163 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12164 | |
| 12165 | |
| 12166 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12167 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12168 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12169 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12170 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12171 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12172 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12174 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12175 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12176 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12177 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12178 | /* Input mixer2 */ |
| 12179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12180 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12181 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12182 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12183 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12184 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12185 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12186 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12188 | /* Input mixer3 */ |
| 12189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12193 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12194 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12195 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12196 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12197 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12198 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12199 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12200 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12201 | { } |
| 12202 | }; |
| 12203 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12204 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12205 | /* |
| 12206 | * Unmute ADC0-2 and set the default input to mic-in |
| 12207 | */ |
| 12208 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12210 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12211 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12212 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12213 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12214 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12215 | /* 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] | 12216 | * mixer widget |
| 12217 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12218 | * panel mic (mic 2) |
| 12219 | */ |
| 12220 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12222 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12223 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12224 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12225 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12226 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12227 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12228 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12229 | /* |
| 12230 | * Set up output mixers (0x0c - 0x0e) |
| 12231 | */ |
| 12232 | /* set vol=0 to output mixers */ |
| 12233 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12234 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12235 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12236 | |
| 12237 | /* set up input amps for analog loopback */ |
| 12238 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12239 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12240 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12241 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12242 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12243 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12244 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12245 | |
| 12246 | |
| 12247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12248 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12249 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12250 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12251 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12252 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12253 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12254 | |
| 12255 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12257 | |
| 12258 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12259 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12260 | |
| 12261 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12262 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12263 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12264 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12265 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12266 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12267 | |
| 12268 | /* FIXME: use matrix-type input source selection */ |
| 12269 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12270 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12271 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12272 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12273 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12274 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12275 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12276 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12277 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12278 | /* Input mixer2 */ |
| 12279 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12280 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12281 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12282 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12283 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12284 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12285 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12286 | /* Input mixer3 */ |
| 12287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12288 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12289 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12290 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12291 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12292 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12293 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12294 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12295 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12296 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12297 | { } |
| 12298 | }; |
| 12299 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12300 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12301 | |
| 12302 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12303 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12304 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12305 | |
| 12306 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12307 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12308 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12309 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12310 | |
| 12311 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12312 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12313 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12314 | {} |
| 12315 | }; |
| 12316 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12317 | /* |
| 12318 | * Pin config fixes |
| 12319 | */ |
| 12320 | enum { |
| 12321 | PINFIX_FSC_H270, |
| 12322 | }; |
| 12323 | |
| 12324 | static const struct alc_fixup alc262_fixups[] = { |
| 12325 | [PINFIX_FSC_H270] = { |
| 12326 | .pins = (const struct alc_pincfg[]) { |
| 12327 | { 0x14, 0x99130110 }, /* speaker */ |
| 12328 | { 0x15, 0x0221142f }, /* front HP */ |
| 12329 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12330 | { } |
| 12331 | } |
| 12332 | }, |
| 12333 | [PINFIX_PB_M5210] = { |
| 12334 | .verbs = (const struct hda_verb[]) { |
| 12335 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 12336 | {} |
| 12337 | } |
| 12338 | }, |
| 12339 | }; |
| 12340 | |
| 12341 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12342 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12343 | {} |
| 12344 | }; |
| 12345 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12346 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12347 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12348 | #define alc262_loopbacks alc880_loopbacks |
| 12349 | #endif |
| 12350 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12351 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12352 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12353 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12354 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12355 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12356 | |
| 12357 | /* |
| 12358 | * BIOS auto configuration |
| 12359 | */ |
| 12360 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12361 | { |
| 12362 | struct alc_spec *spec = codec->spec; |
| 12363 | int err; |
| 12364 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12365 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12366 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12367 | alc262_ignore); |
| 12368 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12369 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12370 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12371 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12372 | spec->multiout.max_channels = 2; |
| 12373 | spec->no_analog = 1; |
| 12374 | goto dig_only; |
| 12375 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12376 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12377 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12378 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12379 | if (err < 0) |
| 12380 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12381 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12382 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12383 | return err; |
| 12384 | |
| 12385 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12386 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12387 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12388 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12389 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12390 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12391 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12392 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12393 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12394 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12395 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12396 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12397 | err = alc_auto_add_mic_boost(codec); |
| 12398 | if (err < 0) |
| 12399 | return err; |
| 12400 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12401 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12402 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12403 | return 1; |
| 12404 | } |
| 12405 | |
| 12406 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12407 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12408 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12409 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12410 | |
| 12411 | |
| 12412 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12413 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12414 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12415 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12416 | alc262_auto_init_multi_out(codec); |
| 12417 | alc262_auto_init_hp_out(codec); |
| 12418 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12419 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12420 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12421 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12422 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12423 | } |
| 12424 | |
| 12425 | /* |
| 12426 | * configuration and preset |
| 12427 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12428 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12429 | [ALC262_BASIC] = "basic", |
| 12430 | [ALC262_HIPPO] = "hippo", |
| 12431 | [ALC262_HIPPO_1] = "hippo_1", |
| 12432 | [ALC262_FUJITSU] = "fujitsu", |
| 12433 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12434 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12435 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12436 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12437 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12438 | [ALC262_BENQ_T31] = "benq-t31", |
| 12439 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12440 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12441 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12442 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12443 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12444 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12445 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12446 | [ALC262_AUTO] = "auto", |
| 12447 | }; |
| 12448 | |
| 12449 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12450 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12451 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12452 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12453 | ALC262_HP_BPC), |
| 12454 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12455 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12456 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12457 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12458 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12459 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12460 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12461 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12462 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12463 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12464 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12465 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12466 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12467 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12468 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12469 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12470 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12471 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12472 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12473 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12474 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12475 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12476 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12477 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12478 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12479 | #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] | 12480 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12481 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12482 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12483 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12484 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12485 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12486 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12487 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12488 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12489 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12490 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12491 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12492 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12493 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12494 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12495 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12496 | {} |
| 12497 | }; |
| 12498 | |
| 12499 | static struct alc_config_preset alc262_presets[] = { |
| 12500 | [ALC262_BASIC] = { |
| 12501 | .mixers = { alc262_base_mixer }, |
| 12502 | .init_verbs = { alc262_init_verbs }, |
| 12503 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12504 | .dac_nids = alc262_dac_nids, |
| 12505 | .hp_nid = 0x03, |
| 12506 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12507 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12508 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12509 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12510 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12511 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12512 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12513 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12514 | .dac_nids = alc262_dac_nids, |
| 12515 | .hp_nid = 0x03, |
| 12516 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12517 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12518 | .channel_mode = alc262_modes, |
| 12519 | .input_mux = &alc262_capture_source, |
| 12520 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12521 | .setup = alc262_hippo_setup, |
| 12522 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12523 | }, |
| 12524 | [ALC262_HIPPO_1] = { |
| 12525 | .mixers = { alc262_hippo1_mixer }, |
| 12526 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12527 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12528 | .dac_nids = alc262_dac_nids, |
| 12529 | .hp_nid = 0x02, |
| 12530 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12531 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12532 | .channel_mode = alc262_modes, |
| 12533 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12534 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12535 | .setup = alc262_hippo1_setup, |
| 12536 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12537 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12538 | [ALC262_FUJITSU] = { |
| 12539 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12540 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12541 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12542 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12543 | .dac_nids = alc262_dac_nids, |
| 12544 | .hp_nid = 0x03, |
| 12545 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12546 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12547 | .channel_mode = alc262_modes, |
| 12548 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12549 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12550 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12551 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12552 | [ALC262_HP_BPC] = { |
| 12553 | .mixers = { alc262_HP_BPC_mixer }, |
| 12554 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12555 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12556 | .dac_nids = alc262_dac_nids, |
| 12557 | .hp_nid = 0x03, |
| 12558 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12559 | .channel_mode = alc262_modes, |
| 12560 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12561 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12562 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12563 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12564 | [ALC262_HP_BPC_D7000_WF] = { |
| 12565 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12566 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12567 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12568 | .dac_nids = alc262_dac_nids, |
| 12569 | .hp_nid = 0x03, |
| 12570 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12571 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12572 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12573 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12574 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12575 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12576 | [ALC262_HP_BPC_D7000_WL] = { |
| 12577 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12578 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12579 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12580 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12581 | .dac_nids = alc262_dac_nids, |
| 12582 | .hp_nid = 0x03, |
| 12583 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12584 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12585 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12586 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12587 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12588 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12589 | [ALC262_HP_TC_T5735] = { |
| 12590 | .mixers = { alc262_hp_t5735_mixer }, |
| 12591 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12592 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12593 | .dac_nids = alc262_dac_nids, |
| 12594 | .hp_nid = 0x03, |
| 12595 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12596 | .channel_mode = alc262_modes, |
| 12597 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12598 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12599 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12600 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12601 | }, |
| 12602 | [ALC262_HP_RP5700] = { |
| 12603 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12604 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12605 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12606 | .dac_nids = alc262_dac_nids, |
| 12607 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12608 | .channel_mode = alc262_modes, |
| 12609 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12610 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12611 | [ALC262_BENQ_ED8] = { |
| 12612 | .mixers = { alc262_base_mixer }, |
| 12613 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12614 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12615 | .dac_nids = alc262_dac_nids, |
| 12616 | .hp_nid = 0x03, |
| 12617 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12618 | .channel_mode = alc262_modes, |
| 12619 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12620 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12621 | [ALC262_SONY_ASSAMD] = { |
| 12622 | .mixers = { alc262_sony_mixer }, |
| 12623 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12624 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12625 | .dac_nids = alc262_dac_nids, |
| 12626 | .hp_nid = 0x02, |
| 12627 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12628 | .channel_mode = alc262_modes, |
| 12629 | .input_mux = &alc262_capture_source, |
| 12630 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12631 | .setup = alc262_hippo_setup, |
| 12632 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12633 | }, |
| 12634 | [ALC262_BENQ_T31] = { |
| 12635 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12636 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12637 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12638 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12639 | .dac_nids = alc262_dac_nids, |
| 12640 | .hp_nid = 0x03, |
| 12641 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12642 | .channel_mode = alc262_modes, |
| 12643 | .input_mux = &alc262_capture_source, |
| 12644 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12645 | .setup = alc262_hippo_setup, |
| 12646 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12647 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12648 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12649 | .mixers = { alc262_ultra_mixer }, |
| 12650 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12651 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12652 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12653 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12654 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12655 | .channel_mode = alc262_modes, |
| 12656 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12657 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12658 | .capsrc_nids = alc262_capsrc_nids, |
| 12659 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12660 | .unsol_event = alc262_ultra_unsol_event, |
| 12661 | .init_hook = alc262_ultra_automute, |
| 12662 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12663 | [ALC262_LENOVO_3000] = { |
| 12664 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12665 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12666 | alc262_lenovo_3000_unsol_verbs, |
| 12667 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12668 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12669 | .dac_nids = alc262_dac_nids, |
| 12670 | .hp_nid = 0x03, |
| 12671 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12672 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12673 | .channel_mode = alc262_modes, |
| 12674 | .input_mux = &alc262_fujitsu_capture_source, |
| 12675 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12676 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12677 | [ALC262_NEC] = { |
| 12678 | .mixers = { alc262_nec_mixer }, |
| 12679 | .init_verbs = { alc262_nec_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, |
| 12685 | .input_mux = &alc262_capture_source, |
| 12686 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12687 | [ALC262_TOSHIBA_S06] = { |
| 12688 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12689 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12690 | alc262_eapd_verbs }, |
| 12691 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12692 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12693 | .dac_nids = alc262_dac_nids, |
| 12694 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12695 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12696 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12697 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12698 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12699 | .unsol_event = alc_sku_unsol_event, |
| 12700 | .setup = alc262_toshiba_s06_setup, |
| 12701 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12702 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12703 | [ALC262_TOSHIBA_RX1] = { |
| 12704 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12705 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12706 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12707 | .dac_nids = alc262_dac_nids, |
| 12708 | .hp_nid = 0x03, |
| 12709 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12710 | .channel_mode = alc262_modes, |
| 12711 | .input_mux = &alc262_capture_source, |
| 12712 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12713 | .setup = alc262_hippo_setup, |
| 12714 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12715 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12716 | [ALC262_TYAN] = { |
| 12717 | .mixers = { alc262_tyan_mixer }, |
| 12718 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12719 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12720 | .dac_nids = alc262_dac_nids, |
| 12721 | .hp_nid = 0x02, |
| 12722 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12723 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12724 | .channel_mode = alc262_modes, |
| 12725 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12726 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12727 | .setup = alc262_tyan_setup, |
| 12728 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12729 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12730 | }; |
| 12731 | |
| 12732 | static int patch_alc262(struct hda_codec *codec) |
| 12733 | { |
| 12734 | struct alc_spec *spec; |
| 12735 | int board_config; |
| 12736 | int err; |
| 12737 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12738 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12739 | if (spec == NULL) |
| 12740 | return -ENOMEM; |
| 12741 | |
| 12742 | codec->spec = spec; |
| 12743 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12744 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12745 | * under-run |
| 12746 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12747 | { |
| 12748 | int tmp; |
| 12749 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12750 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12751 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12752 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12753 | } |
| 12754 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12755 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12756 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12757 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12758 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12759 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12760 | alc262_models, |
| 12761 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12762 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12763 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12764 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12765 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12766 | board_config = ALC262_AUTO; |
| 12767 | } |
| 12768 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12769 | if (board_config == ALC262_AUTO) |
| 12770 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); |
| 12771 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12772 | if (board_config == ALC262_AUTO) { |
| 12773 | /* automatic parse from the BIOS config */ |
| 12774 | err = alc262_parse_auto_config(codec); |
| 12775 | if (err < 0) { |
| 12776 | alc_free(codec); |
| 12777 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12778 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12779 | printk(KERN_INFO |
| 12780 | "hda_codec: Cannot set up configuration " |
| 12781 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12782 | board_config = ALC262_BASIC; |
| 12783 | } |
| 12784 | } |
| 12785 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12786 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12787 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12788 | if (err < 0) { |
| 12789 | alc_free(codec); |
| 12790 | return err; |
| 12791 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12792 | } |
| 12793 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12794 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12795 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12797 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12798 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12799 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12800 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12801 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12802 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12803 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12804 | int i; |
| 12805 | /* check whether the digital-mic has to be supported */ |
| 12806 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12807 | if (spec->input_mux->items[i].index >= 9) |
| 12808 | break; |
| 12809 | } |
| 12810 | if (i < spec->input_mux->num_items) { |
| 12811 | /* use only ADC0 */ |
| 12812 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12813 | spec->num_adc_nids = 1; |
| 12814 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12815 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12816 | /* all analog inputs */ |
| 12817 | /* check whether NID 0x07 is valid */ |
| 12818 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12819 | |
| 12820 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12821 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12822 | if (wcap != AC_WID_AUD_IN) { |
| 12823 | spec->adc_nids = alc262_adc_nids_alt; |
| 12824 | spec->num_adc_nids = |
| 12825 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12826 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12827 | } else { |
| 12828 | spec->adc_nids = alc262_adc_nids; |
| 12829 | spec->num_adc_nids = |
| 12830 | ARRAY_SIZE(alc262_adc_nids); |
| 12831 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12832 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12833 | } |
| 12834 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12835 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12836 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12837 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12838 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12839 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12840 | if (board_config == ALC262_AUTO) |
| 12841 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); |
| 12842 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12843 | spec->vmaster_nid = 0x0c; |
| 12844 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12845 | codec->patch_ops = alc_patch_ops; |
| 12846 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12847 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12848 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12849 | if (!spec->loopback.amplist) |
| 12850 | spec->loopback.amplist = alc262_loopbacks; |
| 12851 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12853 | return 0; |
| 12854 | } |
| 12855 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12856 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12857 | * ALC268 channel source setting (2 channel) |
| 12858 | */ |
| 12859 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12860 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12861 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12862 | static hda_nid_t alc268_dac_nids[2] = { |
| 12863 | /* front, hp */ |
| 12864 | 0x02, 0x03 |
| 12865 | }; |
| 12866 | |
| 12867 | static hda_nid_t alc268_adc_nids[2] = { |
| 12868 | /* ADC0-1 */ |
| 12869 | 0x08, 0x07 |
| 12870 | }; |
| 12871 | |
| 12872 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12873 | /* ADC0 */ |
| 12874 | 0x08 |
| 12875 | }; |
| 12876 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12877 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12878 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12879 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12880 | /* output mixer control */ |
| 12881 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12882 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12883 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12884 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12885 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12886 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12887 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12888 | { } |
| 12889 | }; |
| 12890 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12891 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12892 | /* output mixer control */ |
| 12893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12894 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12895 | ALC262_HIPPO_MASTER_SWITCH, |
| 12896 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12897 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12898 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12899 | { } |
| 12900 | }; |
| 12901 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12902 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12903 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12904 | .ops = &snd_hda_bind_sw, |
| 12905 | .values = { |
| 12906 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12907 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12908 | 0 |
| 12909 | }, |
| 12910 | }; |
| 12911 | |
| 12912 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12913 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12914 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12915 | { } |
| 12916 | }; |
| 12917 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12918 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12919 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12920 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12921 | { } |
| 12922 | }; |
| 12923 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12924 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12925 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12926 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12927 | { } /* end */ |
| 12928 | }; |
| 12929 | |
| 12930 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12931 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12932 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12933 | .ops = &snd_hda_bind_vol, |
| 12934 | .values = { |
| 12935 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12936 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12937 | 0 |
| 12938 | }, |
| 12939 | }; |
| 12940 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12941 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12942 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12943 | { |
| 12944 | struct alc_spec *spec = codec->spec; |
| 12945 | unsigned int mute; |
| 12946 | |
| 12947 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12948 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12949 | spec->sense_updated = 1; |
| 12950 | } |
| 12951 | if (spec->jack_present) |
| 12952 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12953 | else /* unmute internal speaker if necessary */ |
| 12954 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12955 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12956 | HDA_AMP_MUTE, mute); |
| 12957 | } |
| 12958 | |
| 12959 | |
| 12960 | /* bind hp and internal speaker mute (with plug check) */ |
| 12961 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12962 | struct snd_ctl_elem_value *ucontrol) |
| 12963 | { |
| 12964 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12965 | long *valp = ucontrol->value.integer.value; |
| 12966 | int change; |
| 12967 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12968 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12969 | if (change) |
| 12970 | alc268_acer_automute(codec, 0); |
| 12971 | return change; |
| 12972 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12973 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12974 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12975 | /* output mixer control */ |
| 12976 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12977 | { |
| 12978 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12979 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12980 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12981 | .info = snd_hda_mixer_amp_switch_info, |
| 12982 | .get = snd_hda_mixer_amp_switch_get, |
| 12983 | .put = alc268_acer_master_sw_put, |
| 12984 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12985 | }, |
| 12986 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12987 | { } |
| 12988 | }; |
| 12989 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12990 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12991 | /* output mixer control */ |
| 12992 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12993 | { |
| 12994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12995 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12996 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12997 | .info = snd_hda_mixer_amp_switch_info, |
| 12998 | .get = snd_hda_mixer_amp_switch_get, |
| 12999 | .put = alc268_acer_master_sw_put, |
| 13000 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13001 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 13002 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13003 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13004 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13005 | { } |
| 13006 | }; |
| 13007 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13008 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13009 | /* output mixer control */ |
| 13010 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13011 | { |
| 13012 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13013 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13014 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13015 | .info = snd_hda_mixer_amp_switch_info, |
| 13016 | .get = snd_hda_mixer_amp_switch_get, |
| 13017 | .put = alc268_acer_master_sw_put, |
| 13018 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13019 | }, |
| 13020 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13021 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 13022 | { } |
| 13023 | }; |
| 13024 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13025 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13026 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13028 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13029 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13030 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13031 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13032 | { } |
| 13033 | }; |
| 13034 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13035 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13036 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13037 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13038 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13039 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13040 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13041 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13042 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13043 | { } |
| 13044 | }; |
| 13045 | |
| 13046 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13047 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13048 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13049 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13050 | |
| 13051 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13052 | unsigned int res) |
| 13053 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13054 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13055 | return; |
| 13056 | alc268_acer_automute(codec, 1); |
| 13057 | } |
| 13058 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13059 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13060 | { |
| 13061 | alc268_acer_automute(codec, 1); |
| 13062 | } |
| 13063 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13064 | /* toggle speaker-output according to the hp-jack state */ |
| 13065 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13066 | { |
| 13067 | unsigned int present; |
| 13068 | unsigned char bits; |
| 13069 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13070 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13071 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13072 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13073 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13074 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13075 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13076 | } |
| 13077 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13078 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13079 | unsigned int res) |
| 13080 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13081 | switch (res >> 26) { |
| 13082 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13083 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13084 | break; |
| 13085 | case ALC880_MIC_EVENT: |
| 13086 | alc_mic_automute(codec); |
| 13087 | break; |
| 13088 | } |
| 13089 | } |
| 13090 | |
| 13091 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13092 | { |
| 13093 | struct alc_spec *spec = codec->spec; |
| 13094 | spec->ext_mic.pin = 0x18; |
| 13095 | spec->ext_mic.mux_idx = 0; |
| 13096 | spec->int_mic.pin = 0x12; |
| 13097 | spec->int_mic.mux_idx = 6; |
| 13098 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13099 | } |
| 13100 | |
| 13101 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13102 | { |
| 13103 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13104 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13105 | } |
| 13106 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13107 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13108 | /* output mixer control */ |
| 13109 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13110 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13111 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13112 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13113 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13114 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13115 | { } |
| 13116 | }; |
| 13117 | |
| 13118 | static struct hda_verb alc268_dell_verbs[] = { |
| 13119 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13120 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13121 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13122 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13123 | { } |
| 13124 | }; |
| 13125 | |
| 13126 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13127 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13128 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13129 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13130 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13131 | spec->autocfg.hp_pins[0] = 0x15; |
| 13132 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13133 | spec->ext_mic.pin = 0x18; |
| 13134 | spec->ext_mic.mux_idx = 0; |
| 13135 | spec->int_mic.pin = 0x19; |
| 13136 | spec->int_mic.mux_idx = 1; |
| 13137 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13138 | } |
| 13139 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13140 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13141 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13142 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13143 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13144 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13145 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13146 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13147 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13148 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13149 | { } |
| 13150 | }; |
| 13151 | |
| 13152 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13153 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13154 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13155 | { } |
| 13156 | }; |
| 13157 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13158 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13159 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13160 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13161 | spec->autocfg.hp_pins[0] = 0x15; |
| 13162 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13163 | spec->ext_mic.pin = 0x18; |
| 13164 | spec->ext_mic.mux_idx = 0; |
| 13165 | spec->int_mic.pin = 0x19; |
| 13166 | spec->int_mic.mux_idx = 1; |
| 13167 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13168 | } |
| 13169 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13170 | /* |
| 13171 | * generic initialization of ADC, input mixers and output mixers |
| 13172 | */ |
| 13173 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13174 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13175 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13176 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13177 | |
| 13178 | /* |
| 13179 | * Set up output mixers (0x0c - 0x0e) |
| 13180 | */ |
| 13181 | /* set vol=0 to output mixers */ |
| 13182 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13183 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13184 | |
| 13185 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13186 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13187 | |
| 13188 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13189 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13190 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13191 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13192 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13193 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13194 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13195 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13196 | |
| 13197 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13198 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13199 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13200 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13201 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13202 | |
| 13203 | /* set PCBEEP vol = 0, mute connections */ |
| 13204 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13205 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13206 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13207 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13208 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13209 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13210 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13211 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13212 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13213 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13214 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13215 | { } |
| 13216 | }; |
| 13217 | |
| 13218 | /* |
| 13219 | * generic initialization of ADC, input mixers and output mixers |
| 13220 | */ |
| 13221 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13222 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13223 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13224 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13225 | |
| 13226 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13227 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13228 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13229 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13230 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13231 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13232 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13233 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13234 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13235 | |
| 13236 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13237 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13238 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13239 | /* set PCBEEP vol = 0, mute connections */ |
| 13240 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13241 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13242 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13243 | |
| 13244 | { } |
| 13245 | }; |
| 13246 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13247 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13248 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13249 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13250 | { } /* end */ |
| 13251 | }; |
| 13252 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13253 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13254 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13255 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13256 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13257 | { } /* end */ |
| 13258 | }; |
| 13259 | |
| 13260 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13261 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13262 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13263 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13264 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13265 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13266 | { } /* end */ |
| 13267 | }; |
| 13268 | |
| 13269 | static struct hda_input_mux alc268_capture_source = { |
| 13270 | .num_items = 4, |
| 13271 | .items = { |
| 13272 | { "Mic", 0x0 }, |
| 13273 | { "Front Mic", 0x1 }, |
| 13274 | { "Line", 0x2 }, |
| 13275 | { "CD", 0x3 }, |
| 13276 | }, |
| 13277 | }; |
| 13278 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13279 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13280 | .num_items = 3, |
| 13281 | .items = { |
| 13282 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13283 | { "Internal Mic", 0x1 }, |
| 13284 | { "Line", 0x2 }, |
| 13285 | }, |
| 13286 | }; |
| 13287 | |
| 13288 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13289 | .num_items = 3, |
| 13290 | .items = { |
| 13291 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13292 | { "Internal Mic", 0x6 }, |
| 13293 | { "Line", 0x2 }, |
| 13294 | }, |
| 13295 | }; |
| 13296 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13297 | #ifdef CONFIG_SND_DEBUG |
| 13298 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13299 | /* Volume widgets */ |
| 13300 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13301 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13302 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13303 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13304 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13305 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13306 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13307 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13308 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13309 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13310 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13311 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13312 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13313 | /* The below appears problematic on some hardwares */ |
| 13314 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13315 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13316 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13317 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13318 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13319 | |
| 13320 | /* Modes for retasking pin widgets */ |
| 13321 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13322 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13323 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13324 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13325 | |
| 13326 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13327 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13328 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13329 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13330 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13331 | |
| 13332 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13333 | * The ALC268 does not have an SPDIF input. |
| 13334 | */ |
| 13335 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13336 | |
| 13337 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13338 | * this output to turn on an external amplifier. |
| 13339 | */ |
| 13340 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13341 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13342 | |
| 13343 | { } /* end */ |
| 13344 | }; |
| 13345 | #endif |
| 13346 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13347 | /* create input playback/capture controls for the given pin */ |
| 13348 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13349 | const char *ctlname, int idx) |
| 13350 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13351 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13352 | int err; |
| 13353 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13354 | switch (nid) { |
| 13355 | case 0x14: |
| 13356 | case 0x16: |
| 13357 | dac = 0x02; |
| 13358 | break; |
| 13359 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13360 | case 0x1a: /* ALC259/269 only */ |
| 13361 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13362 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13363 | dac = 0x03; |
| 13364 | break; |
| 13365 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13366 | snd_printd(KERN_WARNING "hda_codec: " |
| 13367 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13368 | return 0; |
| 13369 | } |
| 13370 | if (spec->multiout.dac_nids[0] != dac && |
| 13371 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13372 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13373 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13374 | HDA_OUTPUT)); |
| 13375 | if (err < 0) |
| 13376 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13377 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13378 | } |
| 13379 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13380 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13381 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13382 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13383 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13384 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13385 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13386 | if (err < 0) |
| 13387 | return err; |
| 13388 | return 0; |
| 13389 | } |
| 13390 | |
| 13391 | /* add playback controls from the parsed DAC table */ |
| 13392 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13393 | const struct auto_pin_cfg *cfg) |
| 13394 | { |
| 13395 | hda_nid_t nid; |
| 13396 | int err; |
| 13397 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13398 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13399 | |
| 13400 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13401 | if (nid) { |
| 13402 | const char *name; |
| 13403 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13404 | name = "Speaker"; |
| 13405 | else |
| 13406 | name = "Front"; |
| 13407 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13408 | if (err < 0) |
| 13409 | return err; |
| 13410 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13411 | |
| 13412 | nid = cfg->speaker_pins[0]; |
| 13413 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13414 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13415 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13416 | if (err < 0) |
| 13417 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13418 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13419 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13420 | if (err < 0) |
| 13421 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13422 | } |
| 13423 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13424 | if (nid) { |
| 13425 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13426 | if (err < 0) |
| 13427 | return err; |
| 13428 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13429 | |
| 13430 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13431 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13432 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13433 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13434 | if (err < 0) |
| 13435 | return err; |
| 13436 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13437 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13438 | } |
| 13439 | |
| 13440 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13441 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13442 | const struct auto_pin_cfg *cfg) |
| 13443 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13444 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13445 | } |
| 13446 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13447 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13448 | hda_nid_t nid, int pin_type) |
| 13449 | { |
| 13450 | int idx; |
| 13451 | |
| 13452 | alc_set_pin_output(codec, nid, pin_type); |
| 13453 | if (nid == 0x14 || nid == 0x16) |
| 13454 | idx = 0; |
| 13455 | else |
| 13456 | idx = 1; |
| 13457 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13458 | } |
| 13459 | |
| 13460 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13461 | { |
| 13462 | struct alc_spec *spec = codec->spec; |
| 13463 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13464 | if (nid) { |
| 13465 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13466 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13467 | } |
| 13468 | } |
| 13469 | |
| 13470 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13471 | { |
| 13472 | struct alc_spec *spec = codec->spec; |
| 13473 | hda_nid_t pin; |
| 13474 | |
| 13475 | pin = spec->autocfg.hp_pins[0]; |
| 13476 | if (pin) |
| 13477 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13478 | pin = spec->autocfg.speaker_pins[0]; |
| 13479 | if (pin) |
| 13480 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13481 | } |
| 13482 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13483 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13484 | { |
| 13485 | struct alc_spec *spec = codec->spec; |
| 13486 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13487 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13488 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13489 | unsigned int dac_vol1, dac_vol2; |
| 13490 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13491 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13492 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13493 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13494 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13495 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13496 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13497 | AMP_IN_UNMUTE(1)); |
| 13498 | snd_hda_codec_write(codec, 0x10, 0, |
| 13499 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13500 | AMP_IN_UNMUTE(1)); |
| 13501 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13502 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13503 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13504 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13505 | snd_hda_codec_write(codec, 0x10, 0, |
| 13506 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13507 | } |
| 13508 | |
| 13509 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13510 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13511 | dac_vol2 = AMP_OUT_ZERO; |
| 13512 | else if (line_nid == 0x15) |
| 13513 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13514 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13515 | dac_vol2 = AMP_OUT_ZERO; |
| 13516 | else if (hp_nid == 0x15) |
| 13517 | dac_vol1 = AMP_OUT_ZERO; |
| 13518 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13519 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13520 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13521 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13522 | |
| 13523 | snd_hda_codec_write(codec, 0x02, 0, |
| 13524 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13525 | snd_hda_codec_write(codec, 0x03, 0, |
| 13526 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13527 | } |
| 13528 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13529 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13530 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13531 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13532 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13533 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13534 | |
| 13535 | /* |
| 13536 | * BIOS auto configuration |
| 13537 | */ |
| 13538 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13539 | { |
| 13540 | struct alc_spec *spec = codec->spec; |
| 13541 | int err; |
| 13542 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13543 | |
| 13544 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13545 | alc268_ignore); |
| 13546 | if (err < 0) |
| 13547 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13548 | if (!spec->autocfg.line_outs) { |
| 13549 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13550 | spec->multiout.max_channels = 2; |
| 13551 | spec->no_analog = 1; |
| 13552 | goto dig_only; |
| 13553 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13554 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13555 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13556 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13557 | if (err < 0) |
| 13558 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13559 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13560 | if (err < 0) |
| 13561 | return err; |
| 13562 | |
| 13563 | spec->multiout.max_channels = 2; |
| 13564 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13565 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13566 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13567 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13568 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13569 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13570 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13571 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13572 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13573 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13574 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13575 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13576 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13577 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13578 | err = alc_auto_add_mic_boost(codec); |
| 13579 | if (err < 0) |
| 13580 | return err; |
| 13581 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13582 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13583 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13584 | return 1; |
| 13585 | } |
| 13586 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13587 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13588 | |
| 13589 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13590 | static void alc268_auto_init(struct hda_codec *codec) |
| 13591 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13592 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13593 | alc268_auto_init_multi_out(codec); |
| 13594 | alc268_auto_init_hp_out(codec); |
| 13595 | alc268_auto_init_mono_speaker_out(codec); |
| 13596 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13597 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13598 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13599 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13600 | } |
| 13601 | |
| 13602 | /* |
| 13603 | * configuration and preset |
| 13604 | */ |
| 13605 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13606 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13607 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13608 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13609 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13610 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13611 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13612 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13613 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13614 | #ifdef CONFIG_SND_DEBUG |
| 13615 | [ALC268_TEST] = "test", |
| 13616 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13617 | [ALC268_AUTO] = "auto", |
| 13618 | }; |
| 13619 | |
| 13620 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13621 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13622 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13623 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13624 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13625 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13626 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13627 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13628 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13629 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13630 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13631 | /* almost compatible with toshiba but with optional digital outs; |
| 13632 | * auto-probing seems working fine |
| 13633 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13634 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13635 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13636 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13637 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13638 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13639 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13640 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13641 | {} |
| 13642 | }; |
| 13643 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13644 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13645 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13646 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13647 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13648 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13649 | ALC268_TOSHIBA), |
| 13650 | {} |
| 13651 | }; |
| 13652 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13653 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13654 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13655 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13656 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13657 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13658 | alc267_quanta_il1_verbs }, |
| 13659 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13660 | .dac_nids = alc268_dac_nids, |
| 13661 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13662 | .adc_nids = alc268_adc_nids_alt, |
| 13663 | .hp_nid = 0x03, |
| 13664 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13665 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13666 | .unsol_event = alc_sku_unsol_event, |
| 13667 | .setup = alc267_quanta_il1_setup, |
| 13668 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13669 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13670 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13671 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13672 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13673 | .init_verbs = { alc268_base_init_verbs }, |
| 13674 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13675 | .dac_nids = alc268_dac_nids, |
| 13676 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13677 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13678 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13679 | .hp_nid = 0x03, |
| 13680 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13681 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13682 | .channel_mode = alc268_modes, |
| 13683 | .input_mux = &alc268_capture_source, |
| 13684 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13685 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13686 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13687 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13688 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13689 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13690 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13691 | .dac_nids = alc268_dac_nids, |
| 13692 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13693 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13694 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13695 | .hp_nid = 0x03, |
| 13696 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13697 | .channel_mode = alc268_modes, |
| 13698 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13699 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13700 | .setup = alc268_toshiba_setup, |
| 13701 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13702 | }, |
| 13703 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13704 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13705 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13706 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13707 | alc268_acer_verbs }, |
| 13708 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13709 | .dac_nids = alc268_dac_nids, |
| 13710 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13711 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13712 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13713 | .hp_nid = 0x02, |
| 13714 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13715 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13716 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13717 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13718 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13719 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13720 | [ALC268_ACER_DMIC] = { |
| 13721 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13722 | alc268_beep_mixer }, |
| 13723 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13724 | alc268_acer_verbs }, |
| 13725 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13726 | .dac_nids = alc268_dac_nids, |
| 13727 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13728 | .adc_nids = alc268_adc_nids_alt, |
| 13729 | .capsrc_nids = alc268_capsrc_nids, |
| 13730 | .hp_nid = 0x02, |
| 13731 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13732 | .channel_mode = alc268_modes, |
| 13733 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13734 | .unsol_event = alc268_acer_unsol_event, |
| 13735 | .init_hook = alc268_acer_init_hook, |
| 13736 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13737 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13738 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13739 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13740 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13741 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13742 | alc268_acer_aspire_one_verbs }, |
| 13743 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13744 | .dac_nids = alc268_dac_nids, |
| 13745 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13746 | .adc_nids = alc268_adc_nids_alt, |
| 13747 | .capsrc_nids = alc268_capsrc_nids, |
| 13748 | .hp_nid = 0x03, |
| 13749 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13750 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13751 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13752 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13753 | .init_hook = alc268_acer_lc_init_hook, |
| 13754 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13755 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13756 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13757 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13758 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13759 | alc268_dell_verbs }, |
| 13760 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13761 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13762 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13763 | .adc_nids = alc268_adc_nids_alt, |
| 13764 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13765 | .hp_nid = 0x02, |
| 13766 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13767 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13768 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13769 | .setup = alc268_dell_setup, |
| 13770 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13771 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13772 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13773 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13774 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13775 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13776 | alc268_toshiba_verbs }, |
| 13777 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13778 | .dac_nids = alc268_dac_nids, |
| 13779 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13780 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13781 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13782 | .hp_nid = 0x03, |
| 13783 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13784 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13785 | .channel_mode = alc268_modes, |
| 13786 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13787 | .setup = alc268_toshiba_setup, |
| 13788 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13789 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13790 | #ifdef CONFIG_SND_DEBUG |
| 13791 | [ALC268_TEST] = { |
| 13792 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13793 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13794 | alc268_volume_init_verbs }, |
| 13795 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13796 | .dac_nids = alc268_dac_nids, |
| 13797 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13798 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13799 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13800 | .hp_nid = 0x03, |
| 13801 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13802 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13803 | .channel_mode = alc268_modes, |
| 13804 | .input_mux = &alc268_capture_source, |
| 13805 | }, |
| 13806 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13807 | }; |
| 13808 | |
| 13809 | static int patch_alc268(struct hda_codec *codec) |
| 13810 | { |
| 13811 | struct alc_spec *spec; |
| 13812 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13813 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13814 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13815 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13816 | if (spec == NULL) |
| 13817 | return -ENOMEM; |
| 13818 | |
| 13819 | codec->spec = spec; |
| 13820 | |
| 13821 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13822 | alc268_models, |
| 13823 | alc268_cfg_tbl); |
| 13824 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13825 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13826 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13827 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13828 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13829 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13830 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13831 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13832 | board_config = ALC268_AUTO; |
| 13833 | } |
| 13834 | |
| 13835 | if (board_config == ALC268_AUTO) { |
| 13836 | /* automatic parse from the BIOS config */ |
| 13837 | err = alc268_parse_auto_config(codec); |
| 13838 | if (err < 0) { |
| 13839 | alc_free(codec); |
| 13840 | return err; |
| 13841 | } else if (!err) { |
| 13842 | printk(KERN_INFO |
| 13843 | "hda_codec: Cannot set up configuration " |
| 13844 | "from BIOS. Using base mode...\n"); |
| 13845 | board_config = ALC268_3ST; |
| 13846 | } |
| 13847 | } |
| 13848 | |
| 13849 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13850 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13851 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13852 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13853 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13854 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13855 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13856 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13857 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13858 | has_beep = 0; |
| 13859 | for (i = 0; i < spec->num_mixers; i++) { |
| 13860 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13861 | has_beep = 1; |
| 13862 | break; |
| 13863 | } |
| 13864 | } |
| 13865 | |
| 13866 | if (has_beep) { |
| 13867 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13868 | if (err < 0) { |
| 13869 | alc_free(codec); |
| 13870 | return err; |
| 13871 | } |
| 13872 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13873 | /* override the amp caps for beep generator */ |
| 13874 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13875 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13876 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13877 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13878 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13879 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13880 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13881 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13882 | /* check whether NID 0x07 is valid */ |
| 13883 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13884 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13885 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13886 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13887 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13888 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13889 | if (spec->auto_mic || |
| 13890 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13891 | spec->adc_nids = alc268_adc_nids_alt; |
| 13892 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13893 | if (spec->auto_mic) |
| 13894 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13895 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13896 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13897 | else |
| 13898 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13899 | } else { |
| 13900 | spec->adc_nids = alc268_adc_nids; |
| 13901 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13902 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13903 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13904 | /* set default input source */ |
| 13905 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13906 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13907 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13908 | i < spec->num_mux_defs ? |
| 13909 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13910 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13911 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13912 | |
| 13913 | spec->vmaster_nid = 0x02; |
| 13914 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13915 | codec->patch_ops = alc_patch_ops; |
| 13916 | if (board_config == ALC268_AUTO) |
| 13917 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13918 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13919 | return 0; |
| 13920 | } |
| 13921 | |
| 13922 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13923 | * ALC269 channel source setting (2 channel) |
| 13924 | */ |
| 13925 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13926 | |
| 13927 | #define alc269_dac_nids alc260_dac_nids |
| 13928 | |
| 13929 | static hda_nid_t alc269_adc_nids[1] = { |
| 13930 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13931 | 0x08, |
| 13932 | }; |
| 13933 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13934 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13935 | 0x23, |
| 13936 | }; |
| 13937 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13938 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13939 | /* ADC1 */ |
| 13940 | 0x09, |
| 13941 | }; |
| 13942 | |
| 13943 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13944 | 0x22, |
| 13945 | }; |
| 13946 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13947 | static hda_nid_t alc269_adc_candidates[] = { |
| 13948 | 0x08, 0x09, 0x07, |
| 13949 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13950 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13951 | #define alc269_modes alc260_modes |
| 13952 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13953 | |
| 13954 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13955 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13956 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13957 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13958 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13959 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13960 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13961 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13962 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13963 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13964 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13965 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13966 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13967 | { } /* end */ |
| 13968 | }; |
| 13969 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13970 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13971 | /* output mixer control */ |
| 13972 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13973 | { |
| 13974 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13975 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13976 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13977 | .info = snd_hda_mixer_amp_switch_info, |
| 13978 | .get = snd_hda_mixer_amp_switch_get, |
| 13979 | .put = alc268_acer_master_sw_put, |
| 13980 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13981 | }, |
| 13982 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13983 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13984 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13985 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13986 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13987 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13988 | { } |
| 13989 | }; |
| 13990 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13991 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13992 | /* output mixer control */ |
| 13993 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13994 | { |
| 13995 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13996 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13997 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13998 | .info = snd_hda_mixer_amp_switch_info, |
| 13999 | .get = snd_hda_mixer_amp_switch_get, |
| 14000 | .put = alc268_acer_master_sw_put, |
| 14001 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14002 | }, |
| 14003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14005 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14006 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14007 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 14008 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 14009 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14010 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 14011 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14012 | { } |
| 14013 | }; |
| 14014 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14015 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14016 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14017 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14018 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14019 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14020 | { } /* end */ |
| 14021 | }; |
| 14022 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14023 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14024 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14025 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14026 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14027 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14028 | { } /* end */ |
| 14029 | }; |
| 14030 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14031 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14032 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14033 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14034 | { } /* end */ |
| 14035 | }; |
| 14036 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14037 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14038 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14039 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14040 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 14041 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14042 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 14043 | { } /* end */ |
| 14044 | }; |
| 14045 | |
| 14046 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14047 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14048 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14049 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14050 | { } /* end */ |
| 14051 | }; |
| 14052 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14053 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14054 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14055 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14056 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14057 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 14058 | { } /* end */ |
| 14059 | }; |
| 14060 | |
| 14061 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14062 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14063 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14064 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14065 | { } /* end */ |
| 14066 | }; |
| 14067 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14068 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14069 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14070 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14071 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14072 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14073 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14075 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14076 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14077 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14078 | { } |
| 14079 | }; |
| 14080 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14081 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14083 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14084 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14085 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14086 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14087 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14088 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14089 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14090 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14091 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14092 | { } |
| 14093 | }; |
| 14094 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14095 | /* toggle speaker-output according to the hp-jack state */ |
| 14096 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14097 | { |
| 14098 | unsigned int present; |
| 14099 | unsigned char bits; |
| 14100 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14101 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14102 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14103 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14104 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14105 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14106 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14107 | |
| 14108 | snd_hda_codec_write(codec, 0x20, 0, |
| 14109 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14110 | snd_hda_codec_write(codec, 0x20, 0, |
| 14111 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14112 | |
| 14113 | snd_hda_codec_write(codec, 0x20, 0, |
| 14114 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14115 | snd_hda_codec_write(codec, 0x20, 0, |
| 14116 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14117 | } |
| 14118 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14119 | /* toggle speaker-output according to the hp-jacks state */ |
| 14120 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14121 | { |
| 14122 | unsigned int present; |
| 14123 | unsigned char bits; |
| 14124 | |
| 14125 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14126 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14127 | |
| 14128 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14129 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14130 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14131 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14132 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14133 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14134 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14135 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14136 | |
| 14137 | snd_hda_codec_write(codec, 0x20, 0, |
| 14138 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14139 | snd_hda_codec_write(codec, 0x20, 0, |
| 14140 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14141 | |
| 14142 | snd_hda_codec_write(codec, 0x20, 0, |
| 14143 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14144 | snd_hda_codec_write(codec, 0x20, 0, |
| 14145 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14146 | } |
| 14147 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14148 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14149 | { |
| 14150 | unsigned int present_laptop; |
| 14151 | unsigned int present_dock; |
| 14152 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14153 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14154 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14155 | |
| 14156 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14157 | if (present_dock) |
| 14158 | snd_hda_codec_write(codec, 0x23, 0, |
| 14159 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14160 | if (present_laptop) |
| 14161 | snd_hda_codec_write(codec, 0x23, 0, |
| 14162 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14163 | if (!present_dock && !present_laptop) |
| 14164 | snd_hda_codec_write(codec, 0x23, 0, |
| 14165 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14166 | } |
| 14167 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14168 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14169 | unsigned int res) |
| 14170 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14171 | switch (res >> 26) { |
| 14172 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14173 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14174 | break; |
| 14175 | case ALC880_MIC_EVENT: |
| 14176 | alc_mic_automute(codec); |
| 14177 | break; |
| 14178 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14179 | } |
| 14180 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14181 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14182 | unsigned int res) |
| 14183 | { |
| 14184 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14185 | alc269_lifebook_speaker_automute(codec); |
| 14186 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14187 | alc269_lifebook_mic_autoswitch(codec); |
| 14188 | } |
| 14189 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14190 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14191 | { |
| 14192 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14193 | spec->autocfg.hp_pins[0] = 0x15; |
| 14194 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14195 | spec->ext_mic.pin = 0x18; |
| 14196 | spec->ext_mic.mux_idx = 0; |
| 14197 | spec->int_mic.pin = 0x19; |
| 14198 | spec->int_mic.mux_idx = 1; |
| 14199 | spec->auto_mic = 1; |
| 14200 | } |
| 14201 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14202 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14203 | { |
| 14204 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14205 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14206 | } |
| 14207 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14208 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14209 | { |
| 14210 | alc269_lifebook_speaker_automute(codec); |
| 14211 | alc269_lifebook_mic_autoswitch(codec); |
| 14212 | } |
| 14213 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14214 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14215 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14216 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14217 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14218 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14219 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14220 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14221 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14222 | {} |
| 14223 | }; |
| 14224 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14225 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14226 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14227 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14228 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14229 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14230 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14231 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14232 | {} |
| 14233 | }; |
| 14234 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14235 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14236 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14237 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14238 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14239 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14240 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14241 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14242 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14243 | {} |
| 14244 | }; |
| 14245 | |
| 14246 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14247 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14248 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14249 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14250 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14251 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14252 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14253 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14254 | {} |
| 14255 | }; |
| 14256 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14257 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14258 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14259 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14260 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14261 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14262 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14263 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14264 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14265 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14266 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14267 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14268 | { } |
| 14269 | }; |
| 14270 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14271 | /* toggle speaker-output according to the hp-jack state */ |
| 14272 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14273 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14274 | struct alc_spec *spec = codec->spec; |
| 14275 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14276 | unsigned int present; |
| 14277 | unsigned char bits; |
| 14278 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14279 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14280 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14281 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14282 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14283 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14284 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14285 | } |
| 14286 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14287 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14288 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14289 | unsigned int res) |
| 14290 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14291 | switch (res >> 26) { |
| 14292 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14293 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14294 | break; |
| 14295 | case ALC880_MIC_EVENT: |
| 14296 | alc_mic_automute(codec); |
| 14297 | break; |
| 14298 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14299 | } |
| 14300 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14301 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14302 | { |
| 14303 | struct alc_spec *spec = codec->spec; |
| 14304 | spec->autocfg.hp_pins[0] = 0x15; |
| 14305 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14306 | spec->ext_mic.pin = 0x18; |
| 14307 | spec->ext_mic.mux_idx = 0; |
| 14308 | spec->int_mic.pin = 0x19; |
| 14309 | spec->int_mic.mux_idx = 1; |
| 14310 | spec->auto_mic = 1; |
| 14311 | } |
| 14312 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14313 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14314 | { |
| 14315 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14316 | spec->autocfg.hp_pins[0] = 0x15; |
| 14317 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14318 | spec->ext_mic.pin = 0x18; |
| 14319 | spec->ext_mic.mux_idx = 0; |
| 14320 | spec->int_mic.pin = 0x12; |
| 14321 | spec->int_mic.mux_idx = 5; |
| 14322 | spec->auto_mic = 1; |
| 14323 | } |
| 14324 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14325 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14326 | { |
| 14327 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14328 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14329 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14330 | spec->ext_mic.pin = 0x18; |
| 14331 | spec->ext_mic.mux_idx = 0; |
| 14332 | spec->int_mic.pin = 0x19; |
| 14333 | spec->int_mic.mux_idx = 1; |
| 14334 | spec->auto_mic = 1; |
| 14335 | } |
| 14336 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14337 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14338 | { |
| 14339 | struct alc_spec *spec = codec->spec; |
| 14340 | spec->autocfg.hp_pins[0] = 0x21; |
| 14341 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14342 | spec->ext_mic.pin = 0x18; |
| 14343 | spec->ext_mic.mux_idx = 0; |
| 14344 | spec->int_mic.pin = 0x12; |
| 14345 | spec->int_mic.mux_idx = 6; |
| 14346 | spec->auto_mic = 1; |
| 14347 | } |
| 14348 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14349 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14350 | { |
| 14351 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14352 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14353 | } |
| 14354 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14355 | /* |
| 14356 | * generic initialization of ADC, input mixers and output mixers |
| 14357 | */ |
| 14358 | static struct hda_verb alc269_init_verbs[] = { |
| 14359 | /* |
| 14360 | * Unmute ADC0 and set the default input to mic-in |
| 14361 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14362 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14363 | |
| 14364 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14365 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14366 | */ |
| 14367 | /* set vol=0 to output mixers */ |
| 14368 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14369 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14370 | |
| 14371 | /* set up input amps for analog loopback */ |
| 14372 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14373 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14374 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14375 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14376 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14377 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14378 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14379 | |
| 14380 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14381 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14382 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14383 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14384 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14385 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14386 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14387 | |
| 14388 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14389 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14390 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14391 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14392 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14393 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14394 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14395 | |
| 14396 | /* set EAPD */ |
| 14397 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14398 | { } |
| 14399 | }; |
| 14400 | |
| 14401 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14402 | /* |
| 14403 | * Unmute ADC0 and set the default input to mic-in |
| 14404 | */ |
| 14405 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14406 | |
| 14407 | /* |
| 14408 | * Set up output mixers (0x02 - 0x03) |
| 14409 | */ |
| 14410 | /* set vol=0 to output mixers */ |
| 14411 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14412 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14413 | |
| 14414 | /* set up input amps for analog loopback */ |
| 14415 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14417 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14418 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14419 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14420 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14421 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14422 | |
| 14423 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14424 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14425 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14426 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14427 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14428 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14429 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14430 | |
| 14431 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14432 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14433 | |
| 14434 | /* FIXME: use Mux-type input source selection */ |
| 14435 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14436 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14437 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14438 | |
| 14439 | /* set EAPD */ |
| 14440 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14441 | { } |
| 14442 | }; |
| 14443 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14444 | #define alc269_auto_create_multi_out_ctls \ |
| 14445 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14446 | #define alc269_auto_create_input_ctls \ |
| 14447 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14448 | |
| 14449 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14450 | #define alc269_loopbacks alc880_loopbacks |
| 14451 | #endif |
| 14452 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14453 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14454 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14455 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14456 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14457 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14458 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14459 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14460 | .substreams = 1, |
| 14461 | .channels_min = 2, |
| 14462 | .channels_max = 8, |
| 14463 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14464 | /* NID is set in alc_build_pcms */ |
| 14465 | .ops = { |
| 14466 | .open = alc880_playback_pcm_open, |
| 14467 | .prepare = alc880_playback_pcm_prepare, |
| 14468 | .cleanup = alc880_playback_pcm_cleanup |
| 14469 | }, |
| 14470 | }; |
| 14471 | |
| 14472 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14473 | .substreams = 1, |
| 14474 | .channels_min = 2, |
| 14475 | .channels_max = 2, |
| 14476 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14477 | /* NID is set in alc_build_pcms */ |
| 14478 | }; |
| 14479 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14480 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14481 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14482 | { |
| 14483 | switch (codec->subsystem_id) { |
| 14484 | case 0x103c1586: |
| 14485 | return 1; |
| 14486 | } |
| 14487 | return 0; |
| 14488 | } |
| 14489 | |
| 14490 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14491 | { |
| 14492 | /* update mute-LED according to the speaker mute state */ |
| 14493 | if (nid == 0x01 || nid == 0x14) { |
| 14494 | int pinval; |
| 14495 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14496 | HDA_AMP_MUTE) |
| 14497 | pinval = 0x24; |
| 14498 | else |
| 14499 | pinval = 0x20; |
| 14500 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14501 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14502 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14503 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14504 | } |
| 14505 | return alc_check_power_status(codec, nid); |
| 14506 | } |
| 14507 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14508 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14509 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14510 | { |
| 14511 | struct alc_spec *spec = codec->spec; |
| 14512 | |
| 14513 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14514 | return 0; |
| 14515 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14516 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14517 | if (spec->ext_mic.pin <= 0x12) { |
| 14518 | spec->private_adc_nids[0] = 0x08; |
| 14519 | spec->private_adc_nids[1] = 0x11; |
| 14520 | spec->private_capsrc_nids[0] = 0x23; |
| 14521 | spec->private_capsrc_nids[1] = 0x22; |
| 14522 | } else { |
| 14523 | spec->private_adc_nids[0] = 0x11; |
| 14524 | spec->private_adc_nids[1] = 0x08; |
| 14525 | spec->private_capsrc_nids[0] = 0x22; |
| 14526 | spec->private_capsrc_nids[1] = 0x23; |
| 14527 | } |
| 14528 | spec->adc_nids = spec->private_adc_nids; |
| 14529 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14530 | spec->num_adc_nids = 2; |
| 14531 | spec->dual_adc_switch = 1; |
| 14532 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14533 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14534 | return 1; |
| 14535 | } |
| 14536 | return 0; |
| 14537 | } |
| 14538 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14539 | /* |
| 14540 | * BIOS auto configuration |
| 14541 | */ |
| 14542 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14543 | { |
| 14544 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14545 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14546 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14547 | |
| 14548 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14549 | alc269_ignore); |
| 14550 | if (err < 0) |
| 14551 | return err; |
| 14552 | |
| 14553 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14554 | if (err < 0) |
| 14555 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14556 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14557 | if (err < 0) |
| 14558 | return err; |
| 14559 | |
| 14560 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14561 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14562 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14563 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14564 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14565 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14566 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14567 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14568 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14569 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14570 | } else { |
| 14571 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14572 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14573 | } |
| 14574 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14575 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14576 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14577 | |
| 14578 | if (!alc275_setup_dual_adc(codec)) |
| 14579 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14580 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14581 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14582 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14583 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14584 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14585 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14586 | |
| 14587 | err = alc_auto_add_mic_boost(codec); |
| 14588 | if (err < 0) |
| 14589 | return err; |
| 14590 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14591 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14592 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14593 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14594 | return 1; |
| 14595 | } |
| 14596 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14597 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14598 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14599 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14600 | |
| 14601 | |
| 14602 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14603 | static void alc269_auto_init(struct hda_codec *codec) |
| 14604 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14605 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14606 | alc269_auto_init_multi_out(codec); |
| 14607 | alc269_auto_init_hp_out(codec); |
| 14608 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14609 | alc_auto_init_digital(codec); |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 14610 | alc_init_jacks(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14611 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14612 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14613 | } |
| 14614 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14615 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14616 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14617 | { |
| 14618 | struct alc_spec *spec = codec->spec; |
| 14619 | int val; |
| 14620 | |
| 14621 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 14622 | val = alc_read_coef_idx(codec, 0x04); |
| 14623 | /* Power down output pin */ |
| 14624 | alc_write_coef_idx(codec, 0x04, val & ~(1<<11)); |
| 14625 | } |
| 14626 | |
| 14627 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14628 | val = alc_read_coef_idx(codec, 0x04); |
| 14629 | /* Power down output pin */ |
| 14630 | alc_write_coef_idx(codec, 0x04, val & ~(1<<11)); |
| 14631 | msleep(150); |
| 14632 | } |
| 14633 | |
| 14634 | alc_shutup(codec); |
| 14635 | if (spec && spec->power_hook) |
| 14636 | spec->power_hook(codec); |
| 14637 | return 0; |
| 14638 | } |
| 14639 | #endif |
| 14640 | #ifdef SND_HDA_NEEDS_RESUME |
| 14641 | static int alc269_resume(struct hda_codec *codec) |
| 14642 | { |
| 14643 | int val; |
| 14644 | |
| 14645 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14646 | val = alc_read_coef_idx(codec, 0x04); |
| 14647 | /* Power down output pin */ |
| 14648 | alc_write_coef_idx(codec, 0x04, val & ~(1<<11)); |
| 14649 | msleep(150); |
| 14650 | } |
| 14651 | |
| 14652 | codec->patch_ops.init(codec); |
| 14653 | |
| 14654 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 14655 | val = alc_read_coef_idx(codec, 0x04); |
| 14656 | /* Power up output pin */ |
| 14657 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 14658 | msleep(200); |
| 14659 | } |
| 14660 | |
| 14661 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14662 | val = alc_read_coef_idx(codec, 0x04); |
| 14663 | /* Power up output pin */ |
| 14664 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 14665 | } |
| 14666 | |
| 14667 | snd_hda_codec_resume_amp(codec); |
| 14668 | snd_hda_codec_resume_cache(codec); |
| 14669 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14670 | if (codec->patch_ops.check_power_status) |
| 14671 | codec->patch_ops.check_power_status(codec, 0x01); |
| 14672 | #endif |
| 14673 | return 0; |
| 14674 | } |
| 14675 | #endif |
| 14676 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14677 | enum { |
| 14678 | ALC269_FIXUP_SONY_VAIO, |
| 14679 | }; |
| 14680 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14681 | static const struct alc_fixup alc269_fixups[] = { |
| 14682 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14683 | .verbs = (const struct hda_verb[]) { |
| 14684 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14685 | {} |
| 14686 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14687 | }, |
| 14688 | }; |
| 14689 | |
| 14690 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14691 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | dbbcbc0 | 2010-08-23 08:14:35 +0200 | [diff] [blame] | 14692 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14693 | {} |
| 14694 | }; |
| 14695 | |
| 14696 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14697 | /* |
| 14698 | * configuration and preset |
| 14699 | */ |
| 14700 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14701 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14702 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14703 | [ALC269_AMIC] = "laptop-amic", |
| 14704 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14705 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14706 | [ALC269_LIFEBOOK] = "lifebook", |
| 14707 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14708 | }; |
| 14709 | |
| 14710 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14711 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14712 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14713 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14714 | ALC269_AMIC), |
| 14715 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14716 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14717 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14718 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14719 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14720 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14721 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14722 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14723 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14724 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14725 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14726 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14727 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14728 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14729 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14730 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14731 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14732 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14733 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14734 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14735 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14736 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14737 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14738 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14739 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14740 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14741 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14742 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14743 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14744 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14745 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14746 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14747 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14748 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14749 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14750 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14751 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14752 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14753 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14754 | ALC269_DMIC), |
| 14755 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14756 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14757 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14758 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14759 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14760 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14761 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14762 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14763 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14764 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14765 | {} |
| 14766 | }; |
| 14767 | |
| 14768 | static struct alc_config_preset alc269_presets[] = { |
| 14769 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14770 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14771 | .init_verbs = { alc269_init_verbs }, |
| 14772 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14773 | .dac_nids = alc269_dac_nids, |
| 14774 | .hp_nid = 0x03, |
| 14775 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14776 | .channel_mode = alc269_modes, |
| 14777 | .input_mux = &alc269_capture_source, |
| 14778 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14779 | [ALC269_QUANTA_FL1] = { |
| 14780 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14781 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14782 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14783 | .dac_nids = alc269_dac_nids, |
| 14784 | .hp_nid = 0x03, |
| 14785 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14786 | .channel_mode = alc269_modes, |
| 14787 | .input_mux = &alc269_capture_source, |
| 14788 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14789 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14790 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14791 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14792 | [ALC269_AMIC] = { |
| 14793 | .mixers = { alc269_laptop_mixer }, |
| 14794 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14795 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14796 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14797 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14798 | .dac_nids = alc269_dac_nids, |
| 14799 | .hp_nid = 0x03, |
| 14800 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14801 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14802 | .unsol_event = alc269_laptop_unsol_event, |
| 14803 | .setup = alc269_laptop_amic_setup, |
| 14804 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14805 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14806 | [ALC269_DMIC] = { |
| 14807 | .mixers = { alc269_laptop_mixer }, |
| 14808 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14809 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14810 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14811 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14812 | .dac_nids = alc269_dac_nids, |
| 14813 | .hp_nid = 0x03, |
| 14814 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14815 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14816 | .unsol_event = alc269_laptop_unsol_event, |
| 14817 | .setup = alc269_laptop_dmic_setup, |
| 14818 | .init_hook = alc269_laptop_inithook, |
| 14819 | }, |
| 14820 | [ALC269VB_AMIC] = { |
| 14821 | .mixers = { alc269vb_laptop_mixer }, |
| 14822 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14823 | .init_verbs = { alc269vb_init_verbs, |
| 14824 | alc269vb_laptop_amic_init_verbs }, |
| 14825 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14826 | .dac_nids = alc269_dac_nids, |
| 14827 | .hp_nid = 0x03, |
| 14828 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14829 | .channel_mode = alc269_modes, |
| 14830 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14831 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14832 | .init_hook = alc269_laptop_inithook, |
| 14833 | }, |
| 14834 | [ALC269VB_DMIC] = { |
| 14835 | .mixers = { alc269vb_laptop_mixer }, |
| 14836 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14837 | .init_verbs = { alc269vb_init_verbs, |
| 14838 | alc269vb_laptop_dmic_init_verbs }, |
| 14839 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14840 | .dac_nids = alc269_dac_nids, |
| 14841 | .hp_nid = 0x03, |
| 14842 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14843 | .channel_mode = alc269_modes, |
| 14844 | .unsol_event = alc269_laptop_unsol_event, |
| 14845 | .setup = alc269vb_laptop_dmic_setup, |
| 14846 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14847 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14848 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14849 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14850 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14851 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14852 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14853 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14854 | .dac_nids = alc269_dac_nids, |
| 14855 | .hp_nid = 0x03, |
| 14856 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14857 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14858 | .unsol_event = alc269_laptop_unsol_event, |
| 14859 | .setup = alc269_laptop_dmic_setup, |
| 14860 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14861 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14862 | [ALC269_LIFEBOOK] = { |
| 14863 | .mixers = { alc269_lifebook_mixer }, |
| 14864 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14865 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14866 | .dac_nids = alc269_dac_nids, |
| 14867 | .hp_nid = 0x03, |
| 14868 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14869 | .channel_mode = alc269_modes, |
| 14870 | .input_mux = &alc269_capture_source, |
| 14871 | .unsol_event = alc269_lifebook_unsol_event, |
| 14872 | .init_hook = alc269_lifebook_init_hook, |
| 14873 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14874 | [ALC271_ACER] = { |
| 14875 | .mixers = { alc269_asus_mixer }, |
| 14876 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14877 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14878 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14879 | .dac_nids = alc269_dac_nids, |
| 14880 | .adc_nids = alc262_dmic_adc_nids, |
| 14881 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14882 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14883 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14884 | .channel_mode = alc269_modes, |
| 14885 | .input_mux = &alc269_capture_source, |
| 14886 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14887 | .unsol_event = alc_sku_unsol_event, |
| 14888 | .setup = alc269vb_laptop_dmic_setup, |
| 14889 | .init_hook = alc_inithook, |
| 14890 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14891 | }; |
| 14892 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14893 | static int alc269_fill_coef(struct hda_codec *codec) |
| 14894 | { |
| 14895 | int val; |
| 14896 | |
| 14897 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 14898 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14899 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 14900 | } |
| 14901 | |
| 14902 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 14903 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14904 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 14905 | } |
| 14906 | |
| 14907 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 14908 | val = alc_read_coef_idx(codec, 0x04); |
| 14909 | /* Power up output pin */ |
| 14910 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 14911 | } |
| 14912 | |
| 14913 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14914 | val = alc_read_coef_idx(codec, 0xd); |
| 14915 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 14916 | /* Capless ramp up clock control */ |
| 14917 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 14918 | } |
| 14919 | val = alc_read_coef_idx(codec, 0x17); |
| 14920 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 14921 | /* Class D power on reset */ |
| 14922 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 14923 | } |
| 14924 | } |
| 14925 | return 0; |
| 14926 | } |
| 14927 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14928 | static int patch_alc269(struct hda_codec *codec) |
| 14929 | { |
| 14930 | struct alc_spec *spec; |
| 14931 | int board_config; |
| 14932 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14933 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14934 | |
| 14935 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14936 | if (spec == NULL) |
| 14937 | return -ENOMEM; |
| 14938 | |
| 14939 | codec->spec = spec; |
| 14940 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14941 | alc_auto_parse_customize_define(codec); |
| 14942 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14943 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14944 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14945 | spec->cdefine.platform_type == 1) |
| 14946 | alc_codec_rename(codec, "ALC271X"); |
| 14947 | else |
| 14948 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14949 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14950 | } else |
| 14951 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14952 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14953 | alc269_fill_coef(codec); |
| 14954 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14955 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14956 | alc269_models, |
| 14957 | alc269_cfg_tbl); |
| 14958 | |
| 14959 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14960 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14961 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14962 | board_config = ALC269_AUTO; |
| 14963 | } |
| 14964 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14965 | if (board_config == ALC269_AUTO) |
| 14966 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14967 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14968 | if (board_config == ALC269_AUTO) { |
| 14969 | /* automatic parse from the BIOS config */ |
| 14970 | err = alc269_parse_auto_config(codec); |
| 14971 | if (err < 0) { |
| 14972 | alc_free(codec); |
| 14973 | return err; |
| 14974 | } else if (!err) { |
| 14975 | printk(KERN_INFO |
| 14976 | "hda_codec: Cannot set up configuration " |
| 14977 | "from BIOS. Using base mode...\n"); |
| 14978 | board_config = ALC269_BASIC; |
| 14979 | } |
| 14980 | } |
| 14981 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14982 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 14983 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14984 | if (err < 0) { |
| 14985 | alc_free(codec); |
| 14986 | return err; |
| 14987 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14988 | } |
| 14989 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14990 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14991 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14992 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14993 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14994 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14995 | * fix the sample rate of analog I/O to 44.1kHz |
| 14996 | */ |
| 14997 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14998 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14999 | } else if (spec->dual_adc_switch) { |
| 15000 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15001 | /* switch ADC dynamically */ |
| 15002 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15003 | } else { |
| 15004 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15005 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15006 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15007 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15008 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15009 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15010 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 15011 | if (!is_alc269vb) { |
| 15012 | spec->adc_nids = alc269_adc_nids; |
| 15013 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15014 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15015 | } else { |
| 15016 | spec->adc_nids = alc269vb_adc_nids; |
| 15017 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15018 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15019 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15020 | } |
| 15021 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15022 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15023 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15024 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15025 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15026 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15027 | if (board_config == ALC269_AUTO) |
| 15028 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 15029 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15030 | spec->vmaster_nid = 0x02; |
| 15031 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15032 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15033 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15034 | codec->patch_ops.suspend = alc269_suspend; |
| 15035 | #endif |
| 15036 | #ifdef SND_HDA_NEEDS_RESUME |
| 15037 | codec->patch_ops.resume = alc269_resume; |
| 15038 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15039 | if (board_config == ALC269_AUTO) |
| 15040 | spec->init_hook = alc269_auto_init; |
| 15041 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15042 | if (!spec->loopback.amplist) |
| 15043 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15044 | if (alc269_mic2_for_mute_led(codec)) |
| 15045 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15046 | #endif |
| 15047 | |
| 15048 | return 0; |
| 15049 | } |
| 15050 | |
| 15051 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15052 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15053 | */ |
| 15054 | |
| 15055 | /* |
| 15056 | * set the path ways for 2 channel output |
| 15057 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15058 | */ |
| 15059 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15060 | /* set pin widget 1Ah (line in) for input */ |
| 15061 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15062 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15063 | * the vref |
| 15064 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15065 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15066 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15067 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15068 | #if 0 |
| 15069 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15070 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15071 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15072 | { } /* end */ |
| 15073 | }; |
| 15074 | /* |
| 15075 | * 6ch mode |
| 15076 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15077 | */ |
| 15078 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15079 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15080 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15081 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15082 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15083 | |
| 15084 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15085 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15086 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15087 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15088 | #if 0 |
| 15089 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15090 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15091 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15092 | { } /* end */ |
| 15093 | }; |
| 15094 | |
| 15095 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15096 | { 2, alc861_threestack_ch2_init }, |
| 15097 | { 6, alc861_threestack_ch6_init }, |
| 15098 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15099 | /* Set mic1 as input and unmute the mixer */ |
| 15100 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15101 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15102 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15103 | { } /* end */ |
| 15104 | }; |
| 15105 | /* Set mic1 as output and mute mixer */ |
| 15106 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15107 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15108 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15109 | { } /* end */ |
| 15110 | }; |
| 15111 | |
| 15112 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15113 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15114 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15115 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15116 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15117 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15118 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15119 | /* set pin widget 1Ah (line in) for input */ |
| 15120 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15121 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15122 | * the vref |
| 15123 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15124 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15125 | |
| 15126 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15127 | #if 0 |
| 15128 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15129 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15130 | #endif |
| 15131 | { } /* end */ |
| 15132 | }; |
| 15133 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15134 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15135 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15136 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15137 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15138 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15139 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15140 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15141 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15142 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15143 | |
| 15144 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15145 | #if 0 |
| 15146 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15147 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15148 | #endif |
| 15149 | { } /* end */ |
| 15150 | }; |
| 15151 | |
| 15152 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15153 | { 2, alc861_asus_ch2_init }, |
| 15154 | { 6, alc861_asus_ch6_init }, |
| 15155 | }; |
| 15156 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15157 | /* patch-ALC861 */ |
| 15158 | |
| 15159 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15160 | /* output mixer control */ |
| 15161 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15162 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15163 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15164 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15165 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15166 | |
| 15167 | /*Input mixer control */ |
| 15168 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15169 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15170 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15171 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15172 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15173 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15174 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15175 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15176 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15178 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15179 | { } /* end */ |
| 15180 | }; |
| 15181 | |
| 15182 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15183 | /* output mixer control */ |
| 15184 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15185 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15186 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15187 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15188 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15189 | |
| 15190 | /* Input mixer control */ |
| 15191 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15192 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15193 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15194 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15195 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15196 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15198 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15199 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15200 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15202 | { |
| 15203 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15204 | .name = "Channel Mode", |
| 15205 | .info = alc_ch_mode_info, |
| 15206 | .get = alc_ch_mode_get, |
| 15207 | .put = alc_ch_mode_put, |
| 15208 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15209 | }, |
| 15210 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15211 | }; |
| 15212 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15213 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15214 | /* output mixer control */ |
| 15215 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15217 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15218 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15219 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15220 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15221 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15222 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15223 | /* output mixer control */ |
| 15224 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15225 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15226 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15227 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15228 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15229 | |
| 15230 | /* Input mixer control */ |
| 15231 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15232 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15233 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15234 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15235 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15236 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15237 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15238 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15239 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15240 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15241 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15242 | { |
| 15243 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15244 | .name = "Channel Mode", |
| 15245 | .info = alc_ch_mode_info, |
| 15246 | .get = alc_ch_mode_get, |
| 15247 | .put = alc_ch_mode_put, |
| 15248 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15249 | }, |
| 15250 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15251 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15252 | |
| 15253 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15254 | /* output mixer control */ |
| 15255 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15256 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15257 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15258 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15259 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15260 | |
| 15261 | /* Input mixer control */ |
| 15262 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15263 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15264 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15265 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15266 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15267 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15268 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15269 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15270 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15271 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15272 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15273 | { |
| 15274 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15275 | .name = "Channel Mode", |
| 15276 | .info = alc_ch_mode_info, |
| 15277 | .get = alc_ch_mode_get, |
| 15278 | .put = alc_ch_mode_put, |
| 15279 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15280 | }, |
| 15281 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15282 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15283 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15284 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15285 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15286 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15287 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15288 | { } |
| 15289 | }; |
| 15290 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15291 | /* |
| 15292 | * generic initialization of ADC, input mixers and output mixers |
| 15293 | */ |
| 15294 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15295 | /* |
| 15296 | * Unmute ADC0 and set the default input to mic-in |
| 15297 | */ |
| 15298 | /* port-A for surround (rear panel) */ |
| 15299 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15300 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15301 | /* port-B for mic-in (rear panel) with vref */ |
| 15302 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15303 | /* port-C for line-in (rear panel) */ |
| 15304 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15305 | /* port-D for Front */ |
| 15306 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15307 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15308 | /* port-E for HP out (front panel) */ |
| 15309 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15310 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15311 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15312 | /* port-F for mic-in (front panel) with vref */ |
| 15313 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15314 | /* port-G for CLFE (rear panel) */ |
| 15315 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15316 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15317 | /* port-H for side (rear panel) */ |
| 15318 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15319 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15320 | /* CD-in */ |
| 15321 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15322 | /* route front mic to ADC1*/ |
| 15323 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15324 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15325 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15326 | /* Unmute DAC0~3 & spdif out*/ |
| 15327 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15328 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15329 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15330 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15332 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15333 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15334 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15335 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15336 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15337 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15338 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15339 | /* Unmute Stereo Mixer 15 */ |
| 15340 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15341 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15342 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15343 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15344 | |
| 15345 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15346 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15347 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15348 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15349 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15350 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15351 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15352 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15353 | /* hp used DAC 3 (Front) */ |
| 15354 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15355 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15356 | |
| 15357 | { } |
| 15358 | }; |
| 15359 | |
| 15360 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15361 | /* |
| 15362 | * Unmute ADC0 and set the default input to mic-in |
| 15363 | */ |
| 15364 | /* port-A for surround (rear panel) */ |
| 15365 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15366 | /* port-B for mic-in (rear panel) with vref */ |
| 15367 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15368 | /* port-C for line-in (rear panel) */ |
| 15369 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15370 | /* port-D for Front */ |
| 15371 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15372 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15373 | /* port-E for HP out (front panel) */ |
| 15374 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15375 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15376 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15377 | /* port-F for mic-in (front panel) with vref */ |
| 15378 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15379 | /* port-G for CLFE (rear panel) */ |
| 15380 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15381 | /* port-H for side (rear panel) */ |
| 15382 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15383 | /* CD-in */ |
| 15384 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15385 | /* route front mic to ADC1*/ |
| 15386 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15387 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15388 | /* Unmute DAC0~3 & spdif out*/ |
| 15389 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15390 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15391 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15392 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15393 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15394 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15395 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15396 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15397 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15398 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15399 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15400 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15401 | /* Unmute Stereo Mixer 15 */ |
| 15402 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15403 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15404 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15405 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15406 | |
| 15407 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15408 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15409 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15410 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15411 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15412 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15413 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15414 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15415 | /* hp used DAC 3 (Front) */ |
| 15416 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15417 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15418 | { } |
| 15419 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15420 | |
| 15421 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15422 | /* |
| 15423 | * Unmute ADC0 and set the default input to mic-in |
| 15424 | */ |
| 15425 | /* port-A for surround (rear panel) */ |
| 15426 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15427 | /* port-B for mic-in (rear panel) with vref */ |
| 15428 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15429 | /* port-C for line-in (rear panel) */ |
| 15430 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15431 | /* port-D for Front */ |
| 15432 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15433 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15434 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15435 | /* this has to be set to VREF80 */ |
| 15436 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15437 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15438 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15439 | /* port-F for mic-in (front panel) with vref */ |
| 15440 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15441 | /* port-G for CLFE (rear panel) */ |
| 15442 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15443 | /* port-H for side (rear panel) */ |
| 15444 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15445 | /* CD-in */ |
| 15446 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15447 | /* route front mic to ADC1*/ |
| 15448 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15449 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15450 | /* Unmute DAC0~3 & spdif out*/ |
| 15451 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15452 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15453 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15454 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15456 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15457 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15458 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15459 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15460 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15461 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15462 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15463 | /* Unmute Stereo Mixer 15 */ |
| 15464 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15465 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15466 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15467 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15468 | |
| 15469 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15470 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15471 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15472 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15473 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15474 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15475 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15476 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15477 | /* hp used DAC 3 (Front) */ |
| 15478 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15479 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15480 | { } |
| 15481 | }; |
| 15482 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15483 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15484 | /* |
| 15485 | * Unmute ADC0 and set the default input to mic-in |
| 15486 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15487 | /* port-A for surround (rear panel) |
| 15488 | * according to codec#0 this is the HP jack |
| 15489 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15490 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15491 | /* route front PCM to HP */ |
| 15492 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15493 | /* port-B for mic-in (rear panel) with vref */ |
| 15494 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15495 | /* port-C for line-in (rear panel) */ |
| 15496 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15497 | /* port-D for Front */ |
| 15498 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15499 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15500 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15501 | /* this has to be set to VREF80 */ |
| 15502 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15503 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15504 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15505 | /* port-F for mic-in (front panel) with vref */ |
| 15506 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15507 | /* port-G for CLFE (rear panel) */ |
| 15508 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15509 | /* port-H for side (rear panel) */ |
| 15510 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15511 | /* CD-in */ |
| 15512 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15513 | /* route front mic to ADC1*/ |
| 15514 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15516 | /* Unmute DAC0~3 & spdif out*/ |
| 15517 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15518 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15519 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15520 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15521 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15522 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15523 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15524 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15525 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15526 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15527 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15528 | /* Unmute Stereo Mixer 15 */ |
| 15529 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15530 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15531 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15532 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15533 | |
| 15534 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15535 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15536 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15537 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15538 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15539 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15540 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15541 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15542 | /* hp used DAC 3 (Front) */ |
| 15543 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15544 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15545 | { } |
| 15546 | }; |
| 15547 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15548 | /* additional init verbs for ASUS laptops */ |
| 15549 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15550 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15551 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15552 | { } |
| 15553 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15554 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15555 | /* |
| 15556 | * generic initialization of ADC, input mixers and output mixers |
| 15557 | */ |
| 15558 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15559 | /* |
| 15560 | * Unmute ADC0 and set the default input to mic-in |
| 15561 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15562 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15563 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15565 | /* Unmute DAC0~3 & spdif out*/ |
| 15566 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15567 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15568 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15569 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15572 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15573 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15574 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15575 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15576 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15577 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15578 | /* Unmute Stereo Mixer 15 */ |
| 15579 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15580 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15581 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15582 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15583 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15584 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15585 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15586 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15587 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15588 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15589 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15590 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15591 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15592 | |
| 15593 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15594 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15595 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15596 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15597 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15598 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15599 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15600 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15601 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15602 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15603 | |
| 15604 | { } |
| 15605 | }; |
| 15606 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15607 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15608 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15609 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15610 | { } |
| 15611 | }; |
| 15612 | |
| 15613 | /* toggle speaker-output according to the hp-jack state */ |
| 15614 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15615 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15616 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15617 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15618 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15619 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15620 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15621 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15622 | } |
| 15623 | |
| 15624 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15625 | unsigned int res) |
| 15626 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15627 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15628 | alc861_toshiba_automute(codec); |
| 15629 | } |
| 15630 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15631 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15632 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15633 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15634 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15635 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15636 | |
| 15637 | |
| 15638 | #define ALC861_DIGOUT_NID 0x07 |
| 15639 | |
| 15640 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15641 | { 8, NULL } |
| 15642 | }; |
| 15643 | |
| 15644 | static hda_nid_t alc861_dac_nids[4] = { |
| 15645 | /* front, surround, clfe, side */ |
| 15646 | 0x03, 0x06, 0x05, 0x04 |
| 15647 | }; |
| 15648 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15649 | static hda_nid_t alc660_dac_nids[3] = { |
| 15650 | /* front, clfe, surround */ |
| 15651 | 0x03, 0x05, 0x06 |
| 15652 | }; |
| 15653 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15654 | static hda_nid_t alc861_adc_nids[1] = { |
| 15655 | /* ADC0-2 */ |
| 15656 | 0x08, |
| 15657 | }; |
| 15658 | |
| 15659 | static struct hda_input_mux alc861_capture_source = { |
| 15660 | .num_items = 5, |
| 15661 | .items = { |
| 15662 | { "Mic", 0x0 }, |
| 15663 | { "Front Mic", 0x3 }, |
| 15664 | { "Line", 0x1 }, |
| 15665 | { "CD", 0x4 }, |
| 15666 | { "Mixer", 0x5 }, |
| 15667 | }, |
| 15668 | }; |
| 15669 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15670 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15671 | { |
| 15672 | struct alc_spec *spec = codec->spec; |
| 15673 | hda_nid_t mix, srcs[5]; |
| 15674 | int i, j, num; |
| 15675 | |
| 15676 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15677 | return 0; |
| 15678 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15679 | if (num < 0) |
| 15680 | return 0; |
| 15681 | for (i = 0; i < num; i++) { |
| 15682 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15683 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15684 | if (type != AC_WID_AUD_OUT) |
| 15685 | continue; |
| 15686 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15687 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15688 | break; |
| 15689 | if (j >= spec->multiout.num_dacs) |
| 15690 | return srcs[i]; |
| 15691 | } |
| 15692 | return 0; |
| 15693 | } |
| 15694 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15695 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15696 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15697 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15698 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15699 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15700 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15701 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15702 | |
| 15703 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15704 | for (i = 0; i < cfg->line_outs; i++) { |
| 15705 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15706 | dac = alc861_look_for_dac(codec, nid); |
| 15707 | if (!dac) |
| 15708 | continue; |
| 15709 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15710 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15711 | return 0; |
| 15712 | } |
| 15713 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15714 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15715 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15716 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15717 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15718 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15719 | } |
| 15720 | |
| 15721 | /* add playback controls from the parsed DAC table */ |
| 15722 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15723 | const struct auto_pin_cfg *cfg) |
| 15724 | { |
| 15725 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15726 | static const char *chname[4] = { |
| 15727 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15728 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15729 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15730 | int i, err; |
| 15731 | |
| 15732 | if (cfg->line_outs == 1) { |
| 15733 | const char *pfx = NULL; |
| 15734 | if (!cfg->hp_outs) |
| 15735 | pfx = "Master"; |
| 15736 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15737 | pfx = "Speaker"; |
| 15738 | if (pfx) { |
| 15739 | nid = spec->multiout.dac_nids[0]; |
| 15740 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15741 | } |
| 15742 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15743 | |
| 15744 | for (i = 0; i < cfg->line_outs; i++) { |
| 15745 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15746 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15747 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15748 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15749 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15750 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15751 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15752 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15753 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15754 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15755 | return err; |
| 15756 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15757 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15758 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15759 | return err; |
| 15760 | } |
| 15761 | } |
| 15762 | return 0; |
| 15763 | } |
| 15764 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15765 | 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] | 15766 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15767 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15768 | int err; |
| 15769 | hda_nid_t nid; |
| 15770 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15771 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15772 | return 0; |
| 15773 | |
| 15774 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15775 | nid = alc861_look_for_dac(codec, pin); |
| 15776 | if (nid) { |
| 15777 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15778 | if (err < 0) |
| 15779 | return err; |
| 15780 | spec->multiout.hp_nid = nid; |
| 15781 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15782 | } |
| 15783 | return 0; |
| 15784 | } |
| 15785 | |
| 15786 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15787 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15788 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15789 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15790 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15791 | } |
| 15792 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15793 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15794 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15795 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15796 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15797 | hda_nid_t mix, srcs[5]; |
| 15798 | int i, num; |
| 15799 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15800 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15801 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15802 | 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] | 15803 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15804 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15805 | return; |
| 15806 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15807 | if (num < 0) |
| 15808 | return; |
| 15809 | for (i = 0; i < num; i++) { |
| 15810 | unsigned int mute; |
| 15811 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15812 | mute = AMP_IN_UNMUTE(i); |
| 15813 | else |
| 15814 | mute = AMP_IN_MUTE(i); |
| 15815 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15816 | mute); |
| 15817 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15818 | } |
| 15819 | |
| 15820 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15821 | { |
| 15822 | struct alc_spec *spec = codec->spec; |
| 15823 | int i; |
| 15824 | |
| 15825 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15826 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15827 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15828 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15829 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15830 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15831 | } |
| 15832 | } |
| 15833 | |
| 15834 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15835 | { |
| 15836 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15837 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15838 | if (spec->autocfg.hp_outs) |
| 15839 | alc861_auto_set_output_and_unmute(codec, |
| 15840 | spec->autocfg.hp_pins[0], |
| 15841 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15842 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15843 | if (spec->autocfg.speaker_outs) |
| 15844 | alc861_auto_set_output_and_unmute(codec, |
| 15845 | spec->autocfg.speaker_pins[0], |
| 15846 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15847 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15848 | } |
| 15849 | |
| 15850 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15851 | { |
| 15852 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15853 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15854 | int i; |
| 15855 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15856 | for (i = 0; i < cfg->num_inputs; i++) { |
| 15857 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15858 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame^] | 15859 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15860 | } |
| 15861 | } |
| 15862 | |
| 15863 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15864 | /* return 1 if successful, 0 if the proper config is not found, |
| 15865 | * or a negative error code |
| 15866 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15867 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15868 | { |
| 15869 | struct alc_spec *spec = codec->spec; |
| 15870 | int err; |
| 15871 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15872 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15873 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15874 | alc861_ignore); |
| 15875 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15876 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15877 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15878 | return 0; /* can't find valid BIOS pin config */ |
| 15879 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15880 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15881 | if (err < 0) |
| 15882 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15883 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15884 | if (err < 0) |
| 15885 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15886 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15887 | if (err < 0) |
| 15888 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15889 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15890 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15891 | return err; |
| 15892 | |
| 15893 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15894 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15895 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15896 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15897 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15898 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15899 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15900 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15901 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15902 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15903 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15904 | |
| 15905 | spec->adc_nids = alc861_adc_nids; |
| 15906 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15907 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15908 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15909 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15910 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15911 | return 1; |
| 15912 | } |
| 15913 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15914 | /* additional initialization for auto-configuration model */ |
| 15915 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15916 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15917 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15918 | alc861_auto_init_multi_out(codec); |
| 15919 | alc861_auto_init_hp_out(codec); |
| 15920 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15921 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15922 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15923 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15924 | } |
| 15925 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15926 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15927 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15928 | { 0x15, HDA_INPUT, 0 }, |
| 15929 | { 0x15, HDA_INPUT, 1 }, |
| 15930 | { 0x15, HDA_INPUT, 2 }, |
| 15931 | { 0x15, HDA_INPUT, 3 }, |
| 15932 | { } /* end */ |
| 15933 | }; |
| 15934 | #endif |
| 15935 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15936 | |
| 15937 | /* |
| 15938 | * configuration and preset |
| 15939 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15940 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15941 | [ALC861_3ST] = "3stack", |
| 15942 | [ALC660_3ST] = "3stack-660", |
| 15943 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15944 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15945 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15946 | [ALC861_TOSHIBA] = "toshiba", |
| 15947 | [ALC861_ASUS] = "asus", |
| 15948 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15949 | [ALC861_AUTO] = "auto", |
| 15950 | }; |
| 15951 | |
| 15952 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15953 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15954 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15955 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15956 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15957 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15958 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15959 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15960 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15961 | * Any other models that need this preset? |
| 15962 | */ |
| 15963 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15964 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15965 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15966 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15967 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15968 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15969 | /* FIXME: the below seems conflict */ |
| 15970 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15971 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15972 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15973 | {} |
| 15974 | }; |
| 15975 | |
| 15976 | static struct alc_config_preset alc861_presets[] = { |
| 15977 | [ALC861_3ST] = { |
| 15978 | .mixers = { alc861_3ST_mixer }, |
| 15979 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15980 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15981 | .dac_nids = alc861_dac_nids, |
| 15982 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15983 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15984 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15985 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15986 | .adc_nids = alc861_adc_nids, |
| 15987 | .input_mux = &alc861_capture_source, |
| 15988 | }, |
| 15989 | [ALC861_3ST_DIG] = { |
| 15990 | .mixers = { alc861_base_mixer }, |
| 15991 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15992 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15993 | .dac_nids = alc861_dac_nids, |
| 15994 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15995 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15996 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15997 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15998 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15999 | .adc_nids = alc861_adc_nids, |
| 16000 | .input_mux = &alc861_capture_source, |
| 16001 | }, |
| 16002 | [ALC861_6ST_DIG] = { |
| 16003 | .mixers = { alc861_base_mixer }, |
| 16004 | .init_verbs = { alc861_base_init_verbs }, |
| 16005 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16006 | .dac_nids = alc861_dac_nids, |
| 16007 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16008 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16009 | .channel_mode = alc861_8ch_modes, |
| 16010 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16011 | .adc_nids = alc861_adc_nids, |
| 16012 | .input_mux = &alc861_capture_source, |
| 16013 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16014 | [ALC660_3ST] = { |
| 16015 | .mixers = { alc861_3ST_mixer }, |
| 16016 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16017 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16018 | .dac_nids = alc660_dac_nids, |
| 16019 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16020 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16021 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16022 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16023 | .adc_nids = alc861_adc_nids, |
| 16024 | .input_mux = &alc861_capture_source, |
| 16025 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16026 | [ALC861_UNIWILL_M31] = { |
| 16027 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16028 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16029 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16030 | .dac_nids = alc861_dac_nids, |
| 16031 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16032 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16033 | .channel_mode = alc861_uniwill_m31_modes, |
| 16034 | .need_dac_fix = 1, |
| 16035 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16036 | .adc_nids = alc861_adc_nids, |
| 16037 | .input_mux = &alc861_capture_source, |
| 16038 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16039 | [ALC861_TOSHIBA] = { |
| 16040 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16041 | .init_verbs = { alc861_base_init_verbs, |
| 16042 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16043 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16044 | .dac_nids = alc861_dac_nids, |
| 16045 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16046 | .channel_mode = alc883_3ST_2ch_modes, |
| 16047 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16048 | .adc_nids = alc861_adc_nids, |
| 16049 | .input_mux = &alc861_capture_source, |
| 16050 | .unsol_event = alc861_toshiba_unsol_event, |
| 16051 | .init_hook = alc861_toshiba_automute, |
| 16052 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16053 | [ALC861_ASUS] = { |
| 16054 | .mixers = { alc861_asus_mixer }, |
| 16055 | .init_verbs = { alc861_asus_init_verbs }, |
| 16056 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16057 | .dac_nids = alc861_dac_nids, |
| 16058 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16059 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16060 | .channel_mode = alc861_asus_modes, |
| 16061 | .need_dac_fix = 1, |
| 16062 | .hp_nid = 0x06, |
| 16063 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16064 | .adc_nids = alc861_adc_nids, |
| 16065 | .input_mux = &alc861_capture_source, |
| 16066 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16067 | [ALC861_ASUS_LAPTOP] = { |
| 16068 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16069 | .init_verbs = { alc861_asus_init_verbs, |
| 16070 | alc861_asus_laptop_init_verbs }, |
| 16071 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16072 | .dac_nids = alc861_dac_nids, |
| 16073 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16074 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16075 | .channel_mode = alc883_3ST_2ch_modes, |
| 16076 | .need_dac_fix = 1, |
| 16077 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16078 | .adc_nids = alc861_adc_nids, |
| 16079 | .input_mux = &alc861_capture_source, |
| 16080 | }, |
| 16081 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16082 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16083 | /* Pin config fixes */ |
| 16084 | enum { |
| 16085 | PINFIX_FSC_AMILO_PI1505, |
| 16086 | }; |
| 16087 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16088 | static const struct alc_fixup alc861_fixups[] = { |
| 16089 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16090 | .pins = (const struct alc_pincfg[]) { |
| 16091 | { 0x0b, 0x0221101f }, /* HP */ |
| 16092 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16093 | { } |
| 16094 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16095 | }, |
| 16096 | }; |
| 16097 | |
| 16098 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16099 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16100 | {} |
| 16101 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16102 | |
| 16103 | static int patch_alc861(struct hda_codec *codec) |
| 16104 | { |
| 16105 | struct alc_spec *spec; |
| 16106 | int board_config; |
| 16107 | int err; |
| 16108 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16109 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16110 | if (spec == NULL) |
| 16111 | return -ENOMEM; |
| 16112 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16113 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16114 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16115 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16116 | alc861_models, |
| 16117 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16118 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16119 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16120 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16121 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16122 | board_config = ALC861_AUTO; |
| 16123 | } |
| 16124 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16125 | if (board_config == ALC861_AUTO) |
| 16126 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16127 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16128 | if (board_config == ALC861_AUTO) { |
| 16129 | /* automatic parse from the BIOS config */ |
| 16130 | err = alc861_parse_auto_config(codec); |
| 16131 | if (err < 0) { |
| 16132 | alc_free(codec); |
| 16133 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16134 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16135 | printk(KERN_INFO |
| 16136 | "hda_codec: Cannot set up configuration " |
| 16137 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16138 | board_config = ALC861_3ST_DIG; |
| 16139 | } |
| 16140 | } |
| 16141 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16142 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16143 | if (err < 0) { |
| 16144 | alc_free(codec); |
| 16145 | return err; |
| 16146 | } |
| 16147 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16148 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16149 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16150 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16151 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16152 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16153 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16154 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16155 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16156 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16157 | if (!spec->cap_mixer) |
| 16158 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16159 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16160 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16161 | spec->vmaster_nid = 0x03; |
| 16162 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16163 | if (board_config == ALC861_AUTO) |
| 16164 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 16165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16166 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16167 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16168 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16169 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16170 | spec->power_hook = alc_power_eapd; |
| 16171 | #endif |
| 16172 | } |
| 16173 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16174 | if (!spec->loopback.amplist) |
| 16175 | spec->loopback.amplist = alc861_loopbacks; |
| 16176 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16178 | return 0; |
| 16179 | } |
| 16180 | |
| 16181 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16182 | * ALC861-VD support |
| 16183 | * |
| 16184 | * Based on ALC882 |
| 16185 | * |
| 16186 | * In addition, an independent DAC |
| 16187 | */ |
| 16188 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16189 | |
| 16190 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16191 | /* front, surr, clfe, side surr */ |
| 16192 | 0x02, 0x03, 0x04, 0x05 |
| 16193 | }; |
| 16194 | |
| 16195 | /* dac_nids for ALC660vd are in a different order - according to |
| 16196 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16197 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16198 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16199 | * - and it is the same as in 861vd. |
| 16200 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16201 | */ |
| 16202 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16203 | /* front, rear, clfe, rear_surr */ |
| 16204 | 0x02, 0x04, 0x03 |
| 16205 | }; |
| 16206 | |
| 16207 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16208 | /* ADC0 */ |
| 16209 | 0x09, |
| 16210 | }; |
| 16211 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16212 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16213 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16214 | /* input MUX */ |
| 16215 | /* FIXME: should be a matrix-type input source selection */ |
| 16216 | static struct hda_input_mux alc861vd_capture_source = { |
| 16217 | .num_items = 4, |
| 16218 | .items = { |
| 16219 | { "Mic", 0x0 }, |
| 16220 | { "Front Mic", 0x1 }, |
| 16221 | { "Line", 0x2 }, |
| 16222 | { "CD", 0x4 }, |
| 16223 | }, |
| 16224 | }; |
| 16225 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16226 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16227 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16228 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16229 | { "Ext Mic", 0x0 }, |
| 16230 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16231 | }, |
| 16232 | }; |
| 16233 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16234 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16235 | .num_items = 2, |
| 16236 | .items = { |
| 16237 | { "Front Mic", 0x0 }, |
| 16238 | { "ATAPI Mic", 0x1 }, |
| 16239 | }, |
| 16240 | }; |
| 16241 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16242 | /* |
| 16243 | * 2ch mode |
| 16244 | */ |
| 16245 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16246 | { 2, NULL } |
| 16247 | }; |
| 16248 | |
| 16249 | /* |
| 16250 | * 6ch mode |
| 16251 | */ |
| 16252 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16253 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16254 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16255 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16256 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16257 | { } /* end */ |
| 16258 | }; |
| 16259 | |
| 16260 | /* |
| 16261 | * 8ch mode |
| 16262 | */ |
| 16263 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16264 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16265 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16266 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16267 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16268 | { } /* end */ |
| 16269 | }; |
| 16270 | |
| 16271 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16272 | { 6, alc861vd_6stack_ch6_init }, |
| 16273 | { 8, alc861vd_6stack_ch8_init }, |
| 16274 | }; |
| 16275 | |
| 16276 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16277 | { |
| 16278 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16279 | .name = "Channel Mode", |
| 16280 | .info = alc_ch_mode_info, |
| 16281 | .get = alc_ch_mode_get, |
| 16282 | .put = alc_ch_mode_put, |
| 16283 | }, |
| 16284 | { } /* end */ |
| 16285 | }; |
| 16286 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16287 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16288 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16289 | */ |
| 16290 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16291 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16292 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16293 | |
| 16294 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16295 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16296 | |
| 16297 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16298 | HDA_OUTPUT), |
| 16299 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16300 | HDA_OUTPUT), |
| 16301 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16302 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16303 | |
| 16304 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16305 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16306 | |
| 16307 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16308 | |
| 16309 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16310 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16311 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16312 | |
| 16313 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16314 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16315 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16316 | |
| 16317 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16318 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16319 | |
| 16320 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16321 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16322 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16323 | { } /* end */ |
| 16324 | }; |
| 16325 | |
| 16326 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16327 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16328 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16329 | |
| 16330 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16331 | |
| 16332 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16334 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16335 | |
| 16336 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16337 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16338 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16339 | |
| 16340 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16341 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16342 | |
| 16343 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16344 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16345 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16346 | { } /* end */ |
| 16347 | }; |
| 16348 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16349 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16350 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16351 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16352 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16353 | |
| 16354 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16355 | |
| 16356 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16358 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16359 | |
| 16360 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16361 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16362 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16363 | |
| 16364 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16365 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16366 | |
| 16367 | { } /* end */ |
| 16368 | }; |
| 16369 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16370 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 16371 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16372 | */ |
| 16373 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16374 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16375 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16376 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16377 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16378 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16379 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16380 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16381 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16382 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16383 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16384 | { } /* end */ |
| 16385 | }; |
| 16386 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16387 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16388 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16389 | */ |
| 16390 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16391 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16392 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16393 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16394 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16395 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16396 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16397 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16398 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16399 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16400 | { } /* end */ |
| 16401 | }; |
| 16402 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16403 | /* |
| 16404 | * generic initialization of ADC, input mixers and output mixers |
| 16405 | */ |
| 16406 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16407 | /* |
| 16408 | * Unmute ADC0 and set the default input to mic-in |
| 16409 | */ |
| 16410 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16411 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16412 | |
| 16413 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16414 | * the analog-loopback mixer widget |
| 16415 | */ |
| 16416 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16417 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16418 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16419 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16420 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16421 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16422 | |
| 16423 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16424 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16425 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16426 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16427 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16428 | |
| 16429 | /* |
| 16430 | * Set up output mixers (0x02 - 0x05) |
| 16431 | */ |
| 16432 | /* set vol=0 to output mixers */ |
| 16433 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16434 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16435 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16436 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16437 | |
| 16438 | /* set up input amps for analog loopback */ |
| 16439 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16441 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16442 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16443 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16444 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16445 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16446 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16447 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16448 | |
| 16449 | { } |
| 16450 | }; |
| 16451 | |
| 16452 | /* |
| 16453 | * 3-stack pin configuration: |
| 16454 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16455 | */ |
| 16456 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16457 | /* |
| 16458 | * Set pin mode and muting |
| 16459 | */ |
| 16460 | /* set front pin widgets 0x14 for output */ |
| 16461 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16462 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16463 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16464 | |
| 16465 | /* Mic (rear) pin: input vref at 80% */ |
| 16466 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16467 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16468 | /* Front Mic pin: input vref at 80% */ |
| 16469 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16470 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16471 | /* Line In pin: input */ |
| 16472 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16473 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16474 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16475 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16476 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16477 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16478 | /* CD pin widget for input */ |
| 16479 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16480 | |
| 16481 | { } |
| 16482 | }; |
| 16483 | |
| 16484 | /* |
| 16485 | * 6-stack pin configuration: |
| 16486 | */ |
| 16487 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16488 | /* |
| 16489 | * Set pin mode and muting |
| 16490 | */ |
| 16491 | /* set front pin widgets 0x14 for output */ |
| 16492 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16493 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16494 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16495 | |
| 16496 | /* Rear Pin: output 1 (0x0d) */ |
| 16497 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16499 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16500 | /* CLFE Pin: output 2 (0x0e) */ |
| 16501 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16502 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16503 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16504 | /* Side Pin: output 3 (0x0f) */ |
| 16505 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16506 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16507 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16508 | |
| 16509 | /* Mic (rear) pin: input vref at 80% */ |
| 16510 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16511 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16512 | /* Front Mic pin: input vref at 80% */ |
| 16513 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16514 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16515 | /* Line In pin: input */ |
| 16516 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16517 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16518 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16519 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16520 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16521 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16522 | /* CD pin widget for input */ |
| 16523 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16524 | |
| 16525 | { } |
| 16526 | }; |
| 16527 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16528 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16529 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16530 | { } |
| 16531 | }; |
| 16532 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16533 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16534 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16535 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16536 | { } |
| 16537 | }; |
| 16538 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16539 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16541 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16542 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16543 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16544 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16545 | {} |
| 16546 | }; |
| 16547 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16548 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16549 | { |
| 16550 | unsigned int present; |
| 16551 | unsigned char bits; |
| 16552 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16553 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16554 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16555 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16556 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16557 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16558 | } |
| 16559 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16560 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16561 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16562 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16563 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16564 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16565 | } |
| 16566 | |
| 16567 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16568 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16569 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16570 | alc861vd_lenovo_mic_automute(codec); |
| 16571 | } |
| 16572 | |
| 16573 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16574 | unsigned int res) |
| 16575 | { |
| 16576 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16577 | case ALC880_MIC_EVENT: |
| 16578 | alc861vd_lenovo_mic_automute(codec); |
| 16579 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16580 | default: |
| 16581 | alc_automute_amp_unsol_event(codec, res); |
| 16582 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16583 | } |
| 16584 | } |
| 16585 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16586 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16587 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16588 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16589 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16590 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16591 | |
| 16592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(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)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16600 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16602 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16603 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16604 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16605 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16606 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16607 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16608 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16609 | |
| 16610 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16611 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16612 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16613 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16614 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16615 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16616 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16617 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16618 | |
| 16619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16623 | |
| 16624 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16625 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16626 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16627 | |
| 16628 | { } /* end */ |
| 16629 | }; |
| 16630 | |
| 16631 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16632 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16633 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16634 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16635 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16636 | spec->autocfg.hp_pins[0] = 0x15; |
| 16637 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16638 | } |
| 16639 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16640 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16641 | #define alc861vd_loopbacks alc880_loopbacks |
| 16642 | #endif |
| 16643 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16644 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16645 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16646 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16647 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16648 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16649 | |
| 16650 | /* |
| 16651 | * configuration and preset |
| 16652 | */ |
| 16653 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16654 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16655 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16656 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16657 | [ALC861VD_3ST] = "3stack", |
| 16658 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16659 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16660 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16661 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16662 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16663 | [ALC861VD_AUTO] = "auto", |
| 16664 | }; |
| 16665 | |
| 16666 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16667 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16668 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16669 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16670 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16671 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16672 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16673 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16674 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16675 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16676 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16677 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16678 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16679 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16680 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16681 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16682 | {} |
| 16683 | }; |
| 16684 | |
| 16685 | static struct alc_config_preset alc861vd_presets[] = { |
| 16686 | [ALC660VD_3ST] = { |
| 16687 | .mixers = { alc861vd_3st_mixer }, |
| 16688 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16689 | alc861vd_3stack_init_verbs }, |
| 16690 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16691 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16692 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16693 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16694 | .input_mux = &alc861vd_capture_source, |
| 16695 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16696 | [ALC660VD_3ST_DIG] = { |
| 16697 | .mixers = { alc861vd_3st_mixer }, |
| 16698 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16699 | alc861vd_3stack_init_verbs }, |
| 16700 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16701 | .dac_nids = alc660vd_dac_nids, |
| 16702 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16703 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16704 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16705 | .input_mux = &alc861vd_capture_source, |
| 16706 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16707 | [ALC861VD_3ST] = { |
| 16708 | .mixers = { alc861vd_3st_mixer }, |
| 16709 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16710 | alc861vd_3stack_init_verbs }, |
| 16711 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16712 | .dac_nids = alc861vd_dac_nids, |
| 16713 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16714 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16715 | .input_mux = &alc861vd_capture_source, |
| 16716 | }, |
| 16717 | [ALC861VD_3ST_DIG] = { |
| 16718 | .mixers = { alc861vd_3st_mixer }, |
| 16719 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16720 | alc861vd_3stack_init_verbs }, |
| 16721 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16722 | .dac_nids = alc861vd_dac_nids, |
| 16723 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16724 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16725 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16726 | .input_mux = &alc861vd_capture_source, |
| 16727 | }, |
| 16728 | [ALC861VD_6ST_DIG] = { |
| 16729 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16730 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16731 | alc861vd_6stack_init_verbs }, |
| 16732 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16733 | .dac_nids = alc861vd_dac_nids, |
| 16734 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16735 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16736 | .channel_mode = alc861vd_6stack_modes, |
| 16737 | .input_mux = &alc861vd_capture_source, |
| 16738 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16739 | [ALC861VD_LENOVO] = { |
| 16740 | .mixers = { alc861vd_lenovo_mixer }, |
| 16741 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16742 | alc861vd_3stack_init_verbs, |
| 16743 | alc861vd_eapd_verbs, |
| 16744 | alc861vd_lenovo_unsol_verbs }, |
| 16745 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16746 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16747 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16748 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16749 | .input_mux = &alc861vd_capture_source, |
| 16750 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16751 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16752 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16753 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16754 | [ALC861VD_DALLAS] = { |
| 16755 | .mixers = { alc861vd_dallas_mixer }, |
| 16756 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16757 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16758 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16759 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16760 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16761 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16762 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16763 | .setup = alc861vd_dallas_setup, |
| 16764 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16765 | }, |
| 16766 | [ALC861VD_HP] = { |
| 16767 | .mixers = { alc861vd_hp_mixer }, |
| 16768 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16769 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16770 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16771 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16772 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16773 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16774 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16775 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16776 | .setup = alc861vd_dallas_setup, |
| 16777 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16778 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16779 | [ALC660VD_ASUS_V1S] = { |
| 16780 | .mixers = { alc861vd_lenovo_mixer }, |
| 16781 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16782 | alc861vd_3stack_init_verbs, |
| 16783 | alc861vd_eapd_verbs, |
| 16784 | alc861vd_lenovo_unsol_verbs }, |
| 16785 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16786 | .dac_nids = alc660vd_dac_nids, |
| 16787 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16788 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16789 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16790 | .input_mux = &alc861vd_capture_source, |
| 16791 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16792 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16793 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16794 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16795 | }; |
| 16796 | |
| 16797 | /* |
| 16798 | * BIOS auto configuration |
| 16799 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16800 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16801 | const struct auto_pin_cfg *cfg) |
| 16802 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16803 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16804 | } |
| 16805 | |
| 16806 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16807 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16808 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16809 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16810 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16811 | } |
| 16812 | |
| 16813 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16814 | { |
| 16815 | struct alc_spec *spec = codec->spec; |
| 16816 | int i; |
| 16817 | |
| 16818 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16819 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16820 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16821 | if (nid) |
| 16822 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16823 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16824 | } |
| 16825 | } |
| 16826 | |
| 16827 | |
| 16828 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16829 | { |
| 16830 | struct alc_spec *spec = codec->spec; |
| 16831 | hda_nid_t pin; |
| 16832 | |
| 16833 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16834 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16835 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16836 | pin = spec->autocfg.speaker_pins[0]; |
| 16837 | if (pin) |
| 16838 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16839 | } |
| 16840 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16841 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16842 | |
| 16843 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16844 | { |
| 16845 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16846 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16847 | int i; |
| 16848 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16849 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16850 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16851 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame^] | 16852 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16853 | if (nid != ALC861VD_PIN_CD_NID && |
| 16854 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16855 | snd_hda_codec_write(codec, nid, 0, |
| 16856 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16857 | AMP_OUT_MUTE); |
| 16858 | } |
| 16859 | } |
| 16860 | } |
| 16861 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16862 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16863 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16864 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16865 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16866 | |
| 16867 | /* add playback controls from the parsed DAC table */ |
| 16868 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16869 | * different NIDs for mute/unmute switch and volume control */ |
| 16870 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16871 | const struct auto_pin_cfg *cfg) |
| 16872 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16873 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16874 | hda_nid_t nid_v, nid_s; |
| 16875 | int i, err; |
| 16876 | |
| 16877 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16878 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16879 | continue; |
| 16880 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16881 | alc880_dac_to_idx( |
| 16882 | spec->multiout.dac_nids[i])); |
| 16883 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16884 | alc880_dac_to_idx( |
| 16885 | spec->multiout.dac_nids[i])); |
| 16886 | |
| 16887 | if (i == 2) { |
| 16888 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16889 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16890 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16891 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16892 | HDA_OUTPUT)); |
| 16893 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16894 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16895 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16896 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16897 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16898 | HDA_OUTPUT)); |
| 16899 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16900 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16901 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16902 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16903 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16904 | HDA_INPUT)); |
| 16905 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16906 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16907 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16908 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16909 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16910 | HDA_INPUT)); |
| 16911 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16912 | return err; |
| 16913 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16914 | const char *pfx; |
| 16915 | if (cfg->line_outs == 1 && |
| 16916 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16917 | if (!cfg->hp_pins) |
| 16918 | pfx = "Speaker"; |
| 16919 | else |
| 16920 | pfx = "PCM"; |
| 16921 | } else |
| 16922 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16923 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16924 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16925 | HDA_OUTPUT)); |
| 16926 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16927 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16928 | if (cfg->line_outs == 1 && |
| 16929 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16930 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16931 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16932 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16933 | HDA_INPUT)); |
| 16934 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16935 | return err; |
| 16936 | } |
| 16937 | } |
| 16938 | return 0; |
| 16939 | } |
| 16940 | |
| 16941 | /* add playback controls for speaker and HP outputs */ |
| 16942 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16943 | * different NIDs for mute/unmute switch and volume control */ |
| 16944 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16945 | hda_nid_t pin, const char *pfx) |
| 16946 | { |
| 16947 | hda_nid_t nid_v, nid_s; |
| 16948 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16949 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16950 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16951 | return 0; |
| 16952 | |
| 16953 | if (alc880_is_fixed_pin(pin)) { |
| 16954 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16955 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16956 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16957 | spec->multiout.hp_nid = nid_v; |
| 16958 | else |
| 16959 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16960 | /* control HP volume/switch on the output mixer amp */ |
| 16961 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16962 | alc880_fixed_pin_idx(pin)); |
| 16963 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16964 | alc880_fixed_pin_idx(pin)); |
| 16965 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16966 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16967 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16968 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16969 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16970 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16971 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16972 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16973 | return err; |
| 16974 | } else if (alc880_is_multi_pin(pin)) { |
| 16975 | /* set manual connection */ |
| 16976 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16977 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16978 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16979 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16980 | return err; |
| 16981 | } |
| 16982 | return 0; |
| 16983 | } |
| 16984 | |
| 16985 | /* parse the BIOS configuration and set up the alc_spec |
| 16986 | * return 1 if successful, 0 if the proper config is not found, |
| 16987 | * or a negative error code |
| 16988 | * Based on ALC880 version - had to change it to override |
| 16989 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16990 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16991 | { |
| 16992 | struct alc_spec *spec = codec->spec; |
| 16993 | int err; |
| 16994 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16995 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16996 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16997 | alc861vd_ignore); |
| 16998 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16999 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17000 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17001 | return 0; /* can't find valid BIOS pin config */ |
| 17002 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17003 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17004 | if (err < 0) |
| 17005 | return err; |
| 17006 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17007 | if (err < 0) |
| 17008 | return err; |
| 17009 | err = alc861vd_auto_create_extra_out(spec, |
| 17010 | spec->autocfg.speaker_pins[0], |
| 17011 | "Speaker"); |
| 17012 | if (err < 0) |
| 17013 | return err; |
| 17014 | err = alc861vd_auto_create_extra_out(spec, |
| 17015 | spec->autocfg.hp_pins[0], |
| 17016 | "Headphone"); |
| 17017 | if (err < 0) |
| 17018 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17019 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17020 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17021 | return err; |
| 17022 | |
| 17023 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17024 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17025 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17026 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17027 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17028 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17029 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17030 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17031 | |
| 17032 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17033 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17034 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17035 | err = alc_auto_add_mic_boost(codec); |
| 17036 | if (err < 0) |
| 17037 | return err; |
| 17038 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17039 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17040 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17041 | return 1; |
| 17042 | } |
| 17043 | |
| 17044 | /* additional initialization for auto-configuration model */ |
| 17045 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17046 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17047 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17048 | alc861vd_auto_init_multi_out(codec); |
| 17049 | alc861vd_auto_init_hp_out(codec); |
| 17050 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17051 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17052 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17053 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17054 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17055 | } |
| 17056 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17057 | enum { |
| 17058 | ALC660VD_FIX_ASUS_GPIO1 |
| 17059 | }; |
| 17060 | |
| 17061 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17062 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17063 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17064 | .verbs = (const struct hda_verb[]) { |
| 17065 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17066 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17067 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17068 | { } |
| 17069 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17070 | }, |
| 17071 | }; |
| 17072 | |
| 17073 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17074 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17075 | {} |
| 17076 | }; |
| 17077 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17078 | static int patch_alc861vd(struct hda_codec *codec) |
| 17079 | { |
| 17080 | struct alc_spec *spec; |
| 17081 | int err, board_config; |
| 17082 | |
| 17083 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17084 | if (spec == NULL) |
| 17085 | return -ENOMEM; |
| 17086 | |
| 17087 | codec->spec = spec; |
| 17088 | |
| 17089 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17090 | alc861vd_models, |
| 17091 | alc861vd_cfg_tbl); |
| 17092 | |
| 17093 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17094 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17095 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17096 | board_config = ALC861VD_AUTO; |
| 17097 | } |
| 17098 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17099 | if (board_config == ALC861VD_AUTO) |
| 17100 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17101 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17102 | if (board_config == ALC861VD_AUTO) { |
| 17103 | /* automatic parse from the BIOS config */ |
| 17104 | err = alc861vd_parse_auto_config(codec); |
| 17105 | if (err < 0) { |
| 17106 | alc_free(codec); |
| 17107 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17108 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17109 | printk(KERN_INFO |
| 17110 | "hda_codec: Cannot set up configuration " |
| 17111 | "from BIOS. Using base mode...\n"); |
| 17112 | board_config = ALC861VD_3ST; |
| 17113 | } |
| 17114 | } |
| 17115 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17116 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17117 | if (err < 0) { |
| 17118 | alc_free(codec); |
| 17119 | return err; |
| 17120 | } |
| 17121 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17122 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17123 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17124 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17125 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17126 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17127 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17128 | } |
| 17129 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17130 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17131 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17132 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17133 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17134 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17135 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17136 | if (!spec->adc_nids) { |
| 17137 | spec->adc_nids = alc861vd_adc_nids; |
| 17138 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17139 | } |
| 17140 | if (!spec->capsrc_nids) |
| 17141 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17142 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17143 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17144 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17145 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17146 | spec->vmaster_nid = 0x02; |
| 17147 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17148 | if (board_config == ALC861VD_AUTO) |
| 17149 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 17150 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17151 | codec->patch_ops = alc_patch_ops; |
| 17152 | |
| 17153 | if (board_config == ALC861VD_AUTO) |
| 17154 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17155 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17156 | if (!spec->loopback.amplist) |
| 17157 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17158 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17159 | |
| 17160 | return 0; |
| 17161 | } |
| 17162 | |
| 17163 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17164 | * ALC662 support |
| 17165 | * |
| 17166 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17167 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17168 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17169 | * 6-channel independent captures. |
| 17170 | * |
| 17171 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17172 | * driver yet). |
| 17173 | */ |
| 17174 | #define ALC662_DIGOUT_NID 0x06 |
| 17175 | #define ALC662_DIGIN_NID 0x0a |
| 17176 | |
| 17177 | static hda_nid_t alc662_dac_nids[4] = { |
| 17178 | /* front, rear, clfe, rear_surr */ |
| 17179 | 0x02, 0x03, 0x04 |
| 17180 | }; |
| 17181 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17182 | static hda_nid_t alc272_dac_nids[2] = { |
| 17183 | 0x02, 0x03 |
| 17184 | }; |
| 17185 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17186 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17187 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17188 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17189 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17190 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17191 | static hda_nid_t alc272_adc_nids[1] = { |
| 17192 | /* ADC1-2 */ |
| 17193 | 0x08, |
| 17194 | }; |
| 17195 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17196 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17197 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17198 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17199 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17200 | /* input MUX */ |
| 17201 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17202 | static struct hda_input_mux alc662_capture_source = { |
| 17203 | .num_items = 4, |
| 17204 | .items = { |
| 17205 | { "Mic", 0x0 }, |
| 17206 | { "Front Mic", 0x1 }, |
| 17207 | { "Line", 0x2 }, |
| 17208 | { "CD", 0x4 }, |
| 17209 | }, |
| 17210 | }; |
| 17211 | |
| 17212 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17213 | .num_items = 2, |
| 17214 | .items = { |
| 17215 | { "Mic", 0x1 }, |
| 17216 | { "Line", 0x2 }, |
| 17217 | }, |
| 17218 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17219 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17220 | static struct hda_input_mux alc663_capture_source = { |
| 17221 | .num_items = 3, |
| 17222 | .items = { |
| 17223 | { "Mic", 0x0 }, |
| 17224 | { "Front Mic", 0x1 }, |
| 17225 | { "Line", 0x2 }, |
| 17226 | }, |
| 17227 | }; |
| 17228 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17229 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17230 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17231 | .num_items = 16, |
| 17232 | .items = { |
| 17233 | { "Autoselect Mic", 0x0 }, |
| 17234 | { "Internal Mic", 0x1 }, |
| 17235 | { "In-0x02", 0x2 }, |
| 17236 | { "In-0x03", 0x3 }, |
| 17237 | { "In-0x04", 0x4 }, |
| 17238 | { "In-0x05", 0x5 }, |
| 17239 | { "In-0x06", 0x6 }, |
| 17240 | { "In-0x07", 0x7 }, |
| 17241 | { "In-0x08", 0x8 }, |
| 17242 | { "In-0x09", 0x9 }, |
| 17243 | { "In-0x0a", 0x0a }, |
| 17244 | { "In-0x0b", 0x0b }, |
| 17245 | { "In-0x0c", 0x0c }, |
| 17246 | { "In-0x0d", 0x0d }, |
| 17247 | { "In-0x0e", 0x0e }, |
| 17248 | { "In-0x0f", 0x0f }, |
| 17249 | }, |
| 17250 | }; |
| 17251 | #endif |
| 17252 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17253 | /* |
| 17254 | * 2ch mode |
| 17255 | */ |
| 17256 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17257 | { 2, NULL } |
| 17258 | }; |
| 17259 | |
| 17260 | /* |
| 17261 | * 2ch mode |
| 17262 | */ |
| 17263 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17264 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17265 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17266 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17267 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17268 | { } /* end */ |
| 17269 | }; |
| 17270 | |
| 17271 | /* |
| 17272 | * 6ch mode |
| 17273 | */ |
| 17274 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17275 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17276 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17277 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17278 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17279 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17280 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17281 | { } /* end */ |
| 17282 | }; |
| 17283 | |
| 17284 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17285 | { 2, alc662_3ST_ch2_init }, |
| 17286 | { 6, alc662_3ST_ch6_init }, |
| 17287 | }; |
| 17288 | |
| 17289 | /* |
| 17290 | * 2ch mode |
| 17291 | */ |
| 17292 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17293 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17294 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17295 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17296 | { } /* end */ |
| 17297 | }; |
| 17298 | |
| 17299 | /* |
| 17300 | * 6ch mode |
| 17301 | */ |
| 17302 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17303 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17304 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17305 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17306 | { } /* end */ |
| 17307 | }; |
| 17308 | |
| 17309 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17310 | { 2, alc662_sixstack_ch6_init }, |
| 17311 | { 6, alc662_sixstack_ch8_init }, |
| 17312 | }; |
| 17313 | |
| 17314 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17315 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17316 | */ |
| 17317 | |
| 17318 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17319 | /* output mixer control */ |
| 17320 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17321 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17322 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17323 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17324 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17325 | 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] | 17326 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17327 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17328 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17329 | |
| 17330 | /*Input mixer control */ |
| 17331 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17332 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17333 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17334 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17335 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17336 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17337 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17338 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17339 | { } /* end */ |
| 17340 | }; |
| 17341 | |
| 17342 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17343 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17344 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17345 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17346 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17347 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17348 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17349 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17352 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17353 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17354 | { } /* end */ |
| 17355 | }; |
| 17356 | |
| 17357 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17358 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17359 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17360 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17361 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17362 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17363 | 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] | 17364 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17365 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17366 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17367 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17368 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17369 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17370 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17371 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17372 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17373 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17374 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17375 | { } /* end */ |
| 17376 | }; |
| 17377 | |
| 17378 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17379 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17380 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17381 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17382 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17383 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17384 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17385 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17386 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17387 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17388 | { } /* end */ |
| 17389 | }; |
| 17390 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17391 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17392 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17393 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17394 | |
| 17395 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17396 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17397 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17398 | |
| 17399 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17400 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17401 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17402 | { } /* end */ |
| 17403 | }; |
| 17404 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17405 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17406 | ALC262_HIPPO_MASTER_SWITCH, |
| 17407 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17408 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17409 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17410 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17411 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17412 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17413 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17414 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17415 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17416 | { } /* end */ |
| 17417 | }; |
| 17418 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17419 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17420 | .ops = &snd_hda_bind_vol, |
| 17421 | .values = { |
| 17422 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17423 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17424 | 0 |
| 17425 | }, |
| 17426 | }; |
| 17427 | |
| 17428 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17429 | .ops = &snd_hda_bind_sw, |
| 17430 | .values = { |
| 17431 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17432 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17433 | 0 |
| 17434 | }, |
| 17435 | }; |
| 17436 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17437 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17438 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17439 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17440 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17441 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17442 | { } /* end */ |
| 17443 | }; |
| 17444 | |
| 17445 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17446 | .ops = &snd_hda_bind_sw, |
| 17447 | .values = { |
| 17448 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17449 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17450 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17451 | 0 |
| 17452 | }, |
| 17453 | }; |
| 17454 | |
| 17455 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17456 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17457 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17458 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17459 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17460 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17461 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17462 | |
| 17463 | { } /* end */ |
| 17464 | }; |
| 17465 | |
| 17466 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17467 | .ops = &snd_hda_bind_sw, |
| 17468 | .values = { |
| 17469 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17470 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17471 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17472 | 0 |
| 17473 | }, |
| 17474 | }; |
| 17475 | |
| 17476 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17477 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17478 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17479 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17480 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17481 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17482 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17483 | { } /* end */ |
| 17484 | }; |
| 17485 | |
| 17486 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17487 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17488 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17489 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17490 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17491 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17492 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17493 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17494 | { } /* end */ |
| 17495 | }; |
| 17496 | |
| 17497 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17498 | .ops = &snd_hda_bind_vol, |
| 17499 | .values = { |
| 17500 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17501 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17502 | 0 |
| 17503 | }, |
| 17504 | }; |
| 17505 | |
| 17506 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17507 | .ops = &snd_hda_bind_sw, |
| 17508 | .values = { |
| 17509 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17510 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17511 | 0 |
| 17512 | }, |
| 17513 | }; |
| 17514 | |
| 17515 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17516 | HDA_BIND_VOL("Master Playback Volume", |
| 17517 | &alc663_asus_two_bind_master_vol), |
| 17518 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17519 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17520 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17521 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17522 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17523 | { } /* end */ |
| 17524 | }; |
| 17525 | |
| 17526 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17527 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17528 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17529 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17530 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17533 | { } /* end */ |
| 17534 | }; |
| 17535 | |
| 17536 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17537 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17538 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17539 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17540 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17541 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17542 | |
| 17543 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17544 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17545 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17546 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17547 | { } /* end */ |
| 17548 | }; |
| 17549 | |
| 17550 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17551 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17552 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17553 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17554 | |
| 17555 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17557 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17558 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17559 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17560 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17561 | { } /* end */ |
| 17562 | }; |
| 17563 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17564 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17565 | .ops = &snd_hda_bind_sw, |
| 17566 | .values = { |
| 17567 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17568 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17569 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17570 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17571 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17572 | 0 |
| 17573 | }, |
| 17574 | }; |
| 17575 | |
| 17576 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17577 | .ops = &snd_hda_bind_sw, |
| 17578 | .values = { |
| 17579 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17580 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17581 | 0 |
| 17582 | }, |
| 17583 | }; |
| 17584 | |
| 17585 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17586 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17587 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17588 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17589 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17590 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17591 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17592 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17593 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17594 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17595 | { } /* end */ |
| 17596 | }; |
| 17597 | |
| 17598 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17599 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17600 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17601 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17602 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17603 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17604 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17605 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17606 | { } /* end */ |
| 17607 | }; |
| 17608 | |
| 17609 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17610 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17611 | { |
| 17612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17613 | .name = "Channel Mode", |
| 17614 | .info = alc_ch_mode_info, |
| 17615 | .get = alc_ch_mode_get, |
| 17616 | .put = alc_ch_mode_put, |
| 17617 | }, |
| 17618 | { } /* end */ |
| 17619 | }; |
| 17620 | |
| 17621 | static struct hda_verb alc662_init_verbs[] = { |
| 17622 | /* ADC: mute amp left and right */ |
| 17623 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17624 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17625 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17626 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17627 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17628 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17629 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17630 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17631 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17632 | |
| 17633 | /* Front Pin: output 0 (0x0c) */ |
| 17634 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17635 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17636 | |
| 17637 | /* Rear Pin: output 1 (0x0d) */ |
| 17638 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17639 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17640 | |
| 17641 | /* CLFE Pin: output 2 (0x0e) */ |
| 17642 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17643 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17644 | |
| 17645 | /* Mic (rear) pin: input vref at 80% */ |
| 17646 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17647 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17648 | /* Front Mic pin: input vref at 80% */ |
| 17649 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17650 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17651 | /* Line In pin: input */ |
| 17652 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17653 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17654 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17655 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17656 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17657 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17658 | /* CD pin widget for input */ |
| 17659 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17660 | |
| 17661 | /* FIXME: use matrix-type input source selection */ |
| 17662 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17663 | /* Input mixer */ |
| 17664 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17665 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17666 | |
| 17667 | /* always trun on EAPD */ |
| 17668 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17669 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17670 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17671 | { } |
| 17672 | }; |
| 17673 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17674 | static struct hda_verb alc663_init_verbs[] = { |
| 17675 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17676 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17677 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17678 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17679 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17680 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17681 | { } |
| 17682 | }; |
| 17683 | |
| 17684 | static struct hda_verb alc272_init_verbs[] = { |
| 17685 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17686 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17687 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17688 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17689 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17690 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17691 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17692 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17693 | { } |
| 17694 | }; |
| 17695 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17696 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17697 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17698 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17699 | {} |
| 17700 | }; |
| 17701 | |
| 17702 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17703 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17704 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17705 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17706 | }; |
| 17707 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17708 | /* Set Unsolicited Event*/ |
| 17709 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17710 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17711 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17712 | {} |
| 17713 | }; |
| 17714 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17715 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17716 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17717 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17718 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17719 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17720 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17721 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17722 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17723 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17724 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17725 | {} |
| 17726 | }; |
| 17727 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17728 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17729 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17730 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17731 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17732 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17733 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17734 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17735 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17736 | {} |
| 17737 | }; |
| 17738 | |
| 17739 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17740 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17741 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17742 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17743 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17744 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17745 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17746 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17747 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17748 | {} |
| 17749 | }; |
| 17750 | |
| 17751 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17752 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17753 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17754 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17755 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17756 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17757 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17758 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17759 | {} |
| 17760 | }; |
| 17761 | |
| 17762 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17763 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17764 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17765 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17766 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17767 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17768 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17769 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17770 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17772 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17773 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17774 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17775 | {} |
| 17776 | }; |
| 17777 | |
| 17778 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17779 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17780 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17781 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17782 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17783 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17784 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17785 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17786 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17787 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17788 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17789 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17790 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17791 | {} |
| 17792 | }; |
| 17793 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17794 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17795 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17796 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17797 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17798 | |
| 17799 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17800 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17801 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17802 | |
| 17803 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17804 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17805 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17806 | {} |
| 17807 | }; |
| 17808 | |
| 17809 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17810 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17811 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17812 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17813 | |
| 17814 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17815 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17816 | {} |
| 17817 | }; |
| 17818 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17819 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17820 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17821 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17822 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17823 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17824 | {} |
| 17825 | }; |
| 17826 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17827 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17828 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17829 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17830 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17831 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17832 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17833 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17834 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17835 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17836 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17837 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17838 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17839 | {} |
| 17840 | }; |
| 17841 | |
| 17842 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17843 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17844 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17845 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17846 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17847 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17848 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17849 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17850 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17851 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17852 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17853 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17854 | {} |
| 17855 | }; |
| 17856 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17857 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17859 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17860 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17861 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17862 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17863 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17864 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17865 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17866 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17867 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17869 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17870 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17871 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17872 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17873 | {} |
| 17874 | }; |
| 17875 | |
| 17876 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17877 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17878 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17879 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17880 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17881 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17882 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17883 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17884 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17885 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17886 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17887 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17888 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17890 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17891 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17892 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17893 | {} |
| 17894 | }; |
| 17895 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17896 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17897 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17898 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17899 | { } /* end */ |
| 17900 | }; |
| 17901 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17902 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17903 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17904 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17905 | { } /* end */ |
| 17906 | }; |
| 17907 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17908 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17909 | { |
| 17910 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17911 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17912 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17913 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17914 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17915 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17916 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17917 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17918 | } |
| 17919 | |
| 17920 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17921 | { |
| 17922 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17923 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17924 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17925 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17926 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17927 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17928 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17929 | HDA_AMP_MUTE, bits); |
| 17930 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17931 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17932 | } |
| 17933 | |
| 17934 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17935 | unsigned int res) |
| 17936 | { |
| 17937 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17938 | alc662_lenovo_101e_all_automute(codec); |
| 17939 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17940 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17941 | } |
| 17942 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17943 | /* unsolicited event for HP jack sensing */ |
| 17944 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17945 | unsigned int res) |
| 17946 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17947 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17948 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17949 | else |
| 17950 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17951 | } |
| 17952 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17953 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17954 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17955 | struct alc_spec *spec = codec->spec; |
| 17956 | |
| 17957 | alc262_hippo1_setup(codec); |
| 17958 | spec->ext_mic.pin = 0x18; |
| 17959 | spec->ext_mic.mux_idx = 0; |
| 17960 | spec->int_mic.pin = 0x19; |
| 17961 | spec->int_mic.mux_idx = 1; |
| 17962 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17963 | } |
| 17964 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17965 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17966 | { |
| 17967 | alc262_hippo_automute(codec); |
| 17968 | alc_mic_automute(codec); |
| 17969 | } |
| 17970 | |
| 17971 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17972 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17973 | struct alc_spec *spec = codec->spec; |
| 17974 | |
| 17975 | spec->autocfg.hp_pins[0] = 0x14; |
| 17976 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17977 | } |
| 17978 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17979 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17980 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17981 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17982 | { |
| 17983 | unsigned int present; |
| 17984 | unsigned char bits; |
| 17985 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17986 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17987 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17988 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17989 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17990 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17991 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17992 | } |
| 17993 | |
| 17994 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17995 | { |
| 17996 | unsigned int present; |
| 17997 | unsigned char bits; |
| 17998 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17999 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18000 | bits = present ? HDA_AMP_MUTE : 0; |
| 18001 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18002 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18003 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18004 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18005 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18006 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18007 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18008 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18009 | } |
| 18010 | |
| 18011 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18012 | { |
| 18013 | unsigned int present; |
| 18014 | unsigned char bits; |
| 18015 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18016 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18017 | bits = present ? HDA_AMP_MUTE : 0; |
| 18018 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18019 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18020 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18021 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18022 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18023 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18024 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18025 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18026 | } |
| 18027 | |
| 18028 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18029 | { |
| 18030 | unsigned int present; |
| 18031 | unsigned char bits; |
| 18032 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18033 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18034 | bits = present ? 0 : PIN_OUT; |
| 18035 | snd_hda_codec_write(codec, 0x14, 0, |
| 18036 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18037 | } |
| 18038 | |
| 18039 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18040 | { |
| 18041 | unsigned int present1, present2; |
| 18042 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18043 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18044 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18045 | |
| 18046 | if (present1 || present2) { |
| 18047 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18048 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18049 | } else { |
| 18050 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18051 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18052 | } |
| 18053 | } |
| 18054 | |
| 18055 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18056 | { |
| 18057 | unsigned int present1, present2; |
| 18058 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18059 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18060 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18061 | |
| 18062 | if (present1 || present2) { |
| 18063 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18064 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18065 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18066 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18067 | } else { |
| 18068 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18069 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18070 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18071 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18072 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18073 | } |
| 18074 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18075 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18076 | { |
| 18077 | unsigned int present1, present2; |
| 18078 | |
| 18079 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18080 | AC_VERB_GET_PIN_SENSE, 0) |
| 18081 | & AC_PINSENSE_PRESENCE; |
| 18082 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18083 | AC_VERB_GET_PIN_SENSE, 0) |
| 18084 | & AC_PINSENSE_PRESENCE; |
| 18085 | |
| 18086 | if (present1 || present2) { |
| 18087 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18088 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18089 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18090 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18091 | } else { |
| 18092 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18093 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18094 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18095 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18096 | } |
| 18097 | } |
| 18098 | |
| 18099 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18100 | { |
| 18101 | unsigned int present1, present2; |
| 18102 | |
| 18103 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18104 | AC_VERB_GET_PIN_SENSE, 0) |
| 18105 | & AC_PINSENSE_PRESENCE; |
| 18106 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18107 | AC_VERB_GET_PIN_SENSE, 0) |
| 18108 | & AC_PINSENSE_PRESENCE; |
| 18109 | |
| 18110 | if (present1 || present2) { |
| 18111 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18112 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18113 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18114 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18115 | } else { |
| 18116 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18117 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18118 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18119 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18120 | } |
| 18121 | } |
| 18122 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18123 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18124 | unsigned int res) |
| 18125 | { |
| 18126 | switch (res >> 26) { |
| 18127 | case ALC880_HP_EVENT: |
| 18128 | alc663_m51va_speaker_automute(codec); |
| 18129 | break; |
| 18130 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18131 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18132 | break; |
| 18133 | } |
| 18134 | } |
| 18135 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18136 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18137 | { |
| 18138 | struct alc_spec *spec = codec->spec; |
| 18139 | spec->ext_mic.pin = 0x18; |
| 18140 | spec->ext_mic.mux_idx = 0; |
| 18141 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18142 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18143 | spec->auto_mic = 1; |
| 18144 | } |
| 18145 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18146 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18147 | { |
| 18148 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18149 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18150 | } |
| 18151 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18152 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18153 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18154 | |
| 18155 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18156 | { |
| 18157 | struct alc_spec *spec = codec->spec; |
| 18158 | spec->ext_mic.pin = 0x18; |
| 18159 | spec->ext_mic.mux_idx = 0; |
| 18160 | spec->int_mic.pin = 0x19; |
| 18161 | spec->int_mic.mux_idx = 1; |
| 18162 | spec->auto_mic = 1; |
| 18163 | } |
| 18164 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18165 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18166 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18167 | /* ***************** Mode2 ******************************/ |
| 18168 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18169 | unsigned int res) |
| 18170 | { |
| 18171 | switch (res >> 26) { |
| 18172 | case ALC880_HP_EVENT: |
| 18173 | alc662_f5z_speaker_automute(codec); |
| 18174 | break; |
| 18175 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18176 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18177 | break; |
| 18178 | } |
| 18179 | } |
| 18180 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18181 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18182 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18183 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18184 | { |
| 18185 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18186 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18187 | } |
| 18188 | /* ***************** Mode3 ******************************/ |
| 18189 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18190 | unsigned int res) |
| 18191 | { |
| 18192 | switch (res >> 26) { |
| 18193 | case ALC880_HP_EVENT: |
| 18194 | alc663_two_hp_m1_speaker_automute(codec); |
| 18195 | break; |
| 18196 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18197 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18198 | break; |
| 18199 | } |
| 18200 | } |
| 18201 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18202 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18203 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18204 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18205 | { |
| 18206 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18207 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18208 | } |
| 18209 | /* ***************** Mode4 ******************************/ |
| 18210 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18211 | unsigned int res) |
| 18212 | { |
| 18213 | switch (res >> 26) { |
| 18214 | case ALC880_HP_EVENT: |
| 18215 | alc663_21jd_two_speaker_automute(codec); |
| 18216 | break; |
| 18217 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18218 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18219 | break; |
| 18220 | } |
| 18221 | } |
| 18222 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18223 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18224 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18225 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18226 | { |
| 18227 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18228 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18229 | } |
| 18230 | /* ***************** Mode5 ******************************/ |
| 18231 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18232 | unsigned int res) |
| 18233 | { |
| 18234 | switch (res >> 26) { |
| 18235 | case ALC880_HP_EVENT: |
| 18236 | alc663_15jd_two_speaker_automute(codec); |
| 18237 | break; |
| 18238 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18239 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18240 | break; |
| 18241 | } |
| 18242 | } |
| 18243 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18244 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18245 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18246 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18247 | { |
| 18248 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18249 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18250 | } |
| 18251 | /* ***************** Mode6 ******************************/ |
| 18252 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18253 | unsigned int res) |
| 18254 | { |
| 18255 | switch (res >> 26) { |
| 18256 | case ALC880_HP_EVENT: |
| 18257 | alc663_two_hp_m2_speaker_automute(codec); |
| 18258 | break; |
| 18259 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18260 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18261 | break; |
| 18262 | } |
| 18263 | } |
| 18264 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18265 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18266 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18267 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18268 | { |
| 18269 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18270 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18271 | } |
| 18272 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18273 | /* ***************** Mode7 ******************************/ |
| 18274 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18275 | unsigned int res) |
| 18276 | { |
| 18277 | switch (res >> 26) { |
| 18278 | case ALC880_HP_EVENT: |
| 18279 | alc663_two_hp_m7_speaker_automute(codec); |
| 18280 | break; |
| 18281 | case ALC880_MIC_EVENT: |
| 18282 | alc_mic_automute(codec); |
| 18283 | break; |
| 18284 | } |
| 18285 | } |
| 18286 | |
| 18287 | #define alc663_mode7_setup alc663_mode1_setup |
| 18288 | |
| 18289 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18290 | { |
| 18291 | alc663_two_hp_m7_speaker_automute(codec); |
| 18292 | alc_mic_automute(codec); |
| 18293 | } |
| 18294 | |
| 18295 | /* ***************** Mode8 ******************************/ |
| 18296 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18297 | unsigned int res) |
| 18298 | { |
| 18299 | switch (res >> 26) { |
| 18300 | case ALC880_HP_EVENT: |
| 18301 | alc663_two_hp_m8_speaker_automute(codec); |
| 18302 | break; |
| 18303 | case ALC880_MIC_EVENT: |
| 18304 | alc_mic_automute(codec); |
| 18305 | break; |
| 18306 | } |
| 18307 | } |
| 18308 | |
| 18309 | #define alc663_mode8_setup alc663_m51va_setup |
| 18310 | |
| 18311 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18312 | { |
| 18313 | alc663_two_hp_m8_speaker_automute(codec); |
| 18314 | alc_mic_automute(codec); |
| 18315 | } |
| 18316 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18317 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18318 | { |
| 18319 | unsigned int present; |
| 18320 | unsigned char bits; |
| 18321 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18322 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18323 | bits = present ? HDA_AMP_MUTE : 0; |
| 18324 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18325 | HDA_AMP_MUTE, bits); |
| 18326 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18327 | HDA_AMP_MUTE, bits); |
| 18328 | } |
| 18329 | |
| 18330 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18331 | { |
| 18332 | unsigned int present; |
| 18333 | unsigned char bits; |
| 18334 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18335 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18336 | bits = present ? HDA_AMP_MUTE : 0; |
| 18337 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18338 | HDA_AMP_MUTE, bits); |
| 18339 | } |
| 18340 | |
| 18341 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18342 | unsigned int res) |
| 18343 | { |
| 18344 | switch (res >> 26) { |
| 18345 | case ALC880_HP_EVENT: |
| 18346 | alc663_g71v_hp_automute(codec); |
| 18347 | break; |
| 18348 | case ALC880_FRONT_EVENT: |
| 18349 | alc663_g71v_front_automute(codec); |
| 18350 | break; |
| 18351 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18352 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18353 | break; |
| 18354 | } |
| 18355 | } |
| 18356 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18357 | #define alc663_g71v_setup alc663_m51va_setup |
| 18358 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18359 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18360 | { |
| 18361 | alc663_g71v_front_automute(codec); |
| 18362 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18363 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18364 | } |
| 18365 | |
| 18366 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18367 | unsigned int res) |
| 18368 | { |
| 18369 | switch (res >> 26) { |
| 18370 | case ALC880_HP_EVENT: |
| 18371 | alc663_m51va_speaker_automute(codec); |
| 18372 | break; |
| 18373 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18374 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18375 | break; |
| 18376 | } |
| 18377 | } |
| 18378 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18379 | #define alc663_g50v_setup alc663_m51va_setup |
| 18380 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18381 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18382 | { |
| 18383 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18384 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18385 | } |
| 18386 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18387 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18388 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18389 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18390 | |
| 18391 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18392 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18393 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18394 | |
| 18395 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18396 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18397 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18398 | { } /* end */ |
| 18399 | }; |
| 18400 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18401 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18402 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18403 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18404 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18405 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18406 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18407 | |
| 18408 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18409 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18410 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18411 | |
| 18412 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18413 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18414 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18415 | { } /* end */ |
| 18416 | }; |
| 18417 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18418 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18419 | #define alc662_loopbacks alc880_loopbacks |
| 18420 | #endif |
| 18421 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18422 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18423 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18424 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18425 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18426 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18427 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18428 | |
| 18429 | /* |
| 18430 | * configuration and preset |
| 18431 | */ |
| 18432 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18433 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18434 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18435 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18436 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18437 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18438 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18439 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18440 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18441 | [ALC663_ASUS_M51VA] = "m51va", |
| 18442 | [ALC663_ASUS_G71V] = "g71v", |
| 18443 | [ALC663_ASUS_H13] = "h13", |
| 18444 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18445 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18446 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18447 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18448 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18449 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18450 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18451 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18452 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18453 | [ALC272_DELL] = "dell", |
| 18454 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18455 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18456 | [ALC662_AUTO] = "auto", |
| 18457 | }; |
| 18458 | |
| 18459 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18460 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18461 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18462 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18463 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18464 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18465 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18466 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18467 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18468 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18469 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18470 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18471 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18472 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18473 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18474 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18475 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18476 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18477 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18478 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18479 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18480 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18481 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18482 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18483 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18484 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18485 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18486 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18487 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18488 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18489 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18490 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18491 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18492 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18493 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18494 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18495 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18496 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18497 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18498 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18499 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18500 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18501 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18502 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18503 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18504 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18505 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18506 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18507 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18508 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18509 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18510 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18511 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18512 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18513 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18514 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18515 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18516 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18517 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18518 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18519 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18520 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18521 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18522 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18523 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18524 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18525 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18526 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18527 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18528 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18529 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18530 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18531 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18532 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18533 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18534 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18535 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18536 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18537 | {} |
| 18538 | }; |
| 18539 | |
| 18540 | static struct alc_config_preset alc662_presets[] = { |
| 18541 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18542 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18543 | .init_verbs = { alc662_init_verbs }, |
| 18544 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18545 | .dac_nids = alc662_dac_nids, |
| 18546 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18547 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18548 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18549 | .channel_mode = alc662_3ST_2ch_modes, |
| 18550 | .input_mux = &alc662_capture_source, |
| 18551 | }, |
| 18552 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18553 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18554 | .init_verbs = { alc662_init_verbs }, |
| 18555 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18556 | .dac_nids = alc662_dac_nids, |
| 18557 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18558 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18559 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18560 | .channel_mode = alc662_3ST_6ch_modes, |
| 18561 | .need_dac_fix = 1, |
| 18562 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18563 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18564 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18565 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18566 | .init_verbs = { alc662_init_verbs }, |
| 18567 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18568 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18569 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18570 | .channel_mode = alc662_3ST_6ch_modes, |
| 18571 | .need_dac_fix = 1, |
| 18572 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18573 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18574 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18575 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18576 | .init_verbs = { alc662_init_verbs }, |
| 18577 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18578 | .dac_nids = alc662_dac_nids, |
| 18579 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18580 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18581 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18582 | .channel_mode = alc662_5stack_modes, |
| 18583 | .input_mux = &alc662_capture_source, |
| 18584 | }, |
| 18585 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18586 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18587 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18588 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18589 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18590 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18591 | .channel_mode = alc662_3ST_2ch_modes, |
| 18592 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18593 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18594 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18595 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18596 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18597 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18598 | .init_verbs = { alc662_init_verbs, |
| 18599 | alc662_eeepc_sue_init_verbs }, |
| 18600 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18601 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18602 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18603 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18604 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18605 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18606 | .init_hook = alc662_eeepc_inithook, |
| 18607 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18608 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18609 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18610 | alc662_chmode_mixer }, |
| 18611 | .init_verbs = { alc662_init_verbs, |
| 18612 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18613 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18614 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18615 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18616 | .channel_mode = alc662_3ST_6ch_modes, |
| 18617 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18618 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18619 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18620 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18621 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18622 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18623 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18624 | .init_verbs = { alc662_init_verbs, |
| 18625 | alc662_ecs_init_verbs }, |
| 18626 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18627 | .dac_nids = alc662_dac_nids, |
| 18628 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18629 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18630 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18631 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18632 | .init_hook = alc662_eeepc_inithook, |
| 18633 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18634 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18635 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18636 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18637 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18638 | .dac_nids = alc662_dac_nids, |
| 18639 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18640 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18641 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18642 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18643 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18644 | .init_hook = alc663_m51va_inithook, |
| 18645 | }, |
| 18646 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18647 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18648 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18649 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18650 | .dac_nids = alc662_dac_nids, |
| 18651 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18652 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18653 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18654 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18655 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18656 | .init_hook = alc663_g71v_inithook, |
| 18657 | }, |
| 18658 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18659 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18660 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18661 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18662 | .dac_nids = alc662_dac_nids, |
| 18663 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18664 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18665 | .unsol_event = alc663_m51va_unsol_event, |
| 18666 | .init_hook = alc663_m51va_inithook, |
| 18667 | }, |
| 18668 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18669 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18670 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18671 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18672 | .dac_nids = alc662_dac_nids, |
| 18673 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18674 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18675 | .channel_mode = alc662_3ST_6ch_modes, |
| 18676 | .input_mux = &alc663_capture_source, |
| 18677 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18678 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18679 | .init_hook = alc663_g50v_inithook, |
| 18680 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18681 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18682 | .mixers = { alc663_m51va_mixer }, |
| 18683 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18684 | .init_verbs = { alc662_init_verbs, |
| 18685 | alc663_21jd_amic_init_verbs }, |
| 18686 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18687 | .hp_nid = 0x03, |
| 18688 | .dac_nids = alc662_dac_nids, |
| 18689 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18690 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18691 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18692 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18693 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18694 | .init_hook = alc663_mode1_inithook, |
| 18695 | }, |
| 18696 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18697 | .mixers = { alc662_1bjd_mixer }, |
| 18698 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18699 | .init_verbs = { alc662_init_verbs, |
| 18700 | alc662_1bjd_amic_init_verbs }, |
| 18701 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18702 | .dac_nids = alc662_dac_nids, |
| 18703 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18704 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18705 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18706 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18707 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18708 | .init_hook = alc662_mode2_inithook, |
| 18709 | }, |
| 18710 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18711 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18712 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18713 | .init_verbs = { alc662_init_verbs, |
| 18714 | alc663_two_hp_amic_m1_init_verbs }, |
| 18715 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18716 | .hp_nid = 0x03, |
| 18717 | .dac_nids = alc662_dac_nids, |
| 18718 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18719 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18720 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18721 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18722 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18723 | .init_hook = alc663_mode3_inithook, |
| 18724 | }, |
| 18725 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18726 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18727 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18728 | .init_verbs = { alc662_init_verbs, |
| 18729 | alc663_21jd_amic_init_verbs}, |
| 18730 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18731 | .hp_nid = 0x03, |
| 18732 | .dac_nids = alc662_dac_nids, |
| 18733 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18734 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18735 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18736 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18737 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18738 | .init_hook = alc663_mode4_inithook, |
| 18739 | }, |
| 18740 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18741 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18742 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18743 | .init_verbs = { alc662_init_verbs, |
| 18744 | alc663_15jd_amic_init_verbs }, |
| 18745 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18746 | .hp_nid = 0x03, |
| 18747 | .dac_nids = alc662_dac_nids, |
| 18748 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18749 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18750 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18751 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18752 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18753 | .init_hook = alc663_mode5_inithook, |
| 18754 | }, |
| 18755 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18756 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18757 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18758 | .init_verbs = { alc662_init_verbs, |
| 18759 | alc663_two_hp_amic_m2_init_verbs }, |
| 18760 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18761 | .hp_nid = 0x03, |
| 18762 | .dac_nids = alc662_dac_nids, |
| 18763 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18764 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18765 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18766 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18767 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18768 | .init_hook = alc663_mode6_inithook, |
| 18769 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18770 | [ALC663_ASUS_MODE7] = { |
| 18771 | .mixers = { alc663_mode7_mixer }, |
| 18772 | .cap_mixer = alc662_auto_capture_mixer, |
| 18773 | .init_verbs = { alc662_init_verbs, |
| 18774 | alc663_mode7_init_verbs }, |
| 18775 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18776 | .hp_nid = 0x03, |
| 18777 | .dac_nids = alc662_dac_nids, |
| 18778 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18779 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18780 | .channel_mode = alc662_3ST_2ch_modes, |
| 18781 | .unsol_event = alc663_mode7_unsol_event, |
| 18782 | .setup = alc663_mode7_setup, |
| 18783 | .init_hook = alc663_mode7_inithook, |
| 18784 | }, |
| 18785 | [ALC663_ASUS_MODE8] = { |
| 18786 | .mixers = { alc663_mode8_mixer }, |
| 18787 | .cap_mixer = alc662_auto_capture_mixer, |
| 18788 | .init_verbs = { alc662_init_verbs, |
| 18789 | alc663_mode8_init_verbs }, |
| 18790 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18791 | .hp_nid = 0x03, |
| 18792 | .dac_nids = alc662_dac_nids, |
| 18793 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18794 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18795 | .channel_mode = alc662_3ST_2ch_modes, |
| 18796 | .unsol_event = alc663_mode8_unsol_event, |
| 18797 | .setup = alc663_mode8_setup, |
| 18798 | .init_hook = alc663_mode8_inithook, |
| 18799 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18800 | [ALC272_DELL] = { |
| 18801 | .mixers = { alc663_m51va_mixer }, |
| 18802 | .cap_mixer = alc272_auto_capture_mixer, |
| 18803 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18804 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18805 | .dac_nids = alc662_dac_nids, |
| 18806 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18807 | .adc_nids = alc272_adc_nids, |
| 18808 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18809 | .capsrc_nids = alc272_capsrc_nids, |
| 18810 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18811 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18812 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18813 | .init_hook = alc663_m51va_inithook, |
| 18814 | }, |
| 18815 | [ALC272_DELL_ZM1] = { |
| 18816 | .mixers = { alc663_m51va_mixer }, |
| 18817 | .cap_mixer = alc662_auto_capture_mixer, |
| 18818 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18819 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18820 | .dac_nids = alc662_dac_nids, |
| 18821 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18822 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18823 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18824 | .capsrc_nids = alc662_capsrc_nids, |
| 18825 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18826 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18827 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18828 | .init_hook = alc663_m51va_inithook, |
| 18829 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18830 | [ALC272_SAMSUNG_NC10] = { |
| 18831 | .mixers = { alc272_nc10_mixer }, |
| 18832 | .init_verbs = { alc662_init_verbs, |
| 18833 | alc663_21jd_amic_init_verbs }, |
| 18834 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18835 | .dac_nids = alc272_dac_nids, |
| 18836 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18837 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18838 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18839 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18840 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18841 | .init_hook = alc663_mode4_inithook, |
| 18842 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18843 | }; |
| 18844 | |
| 18845 | |
| 18846 | /* |
| 18847 | * BIOS auto configuration |
| 18848 | */ |
| 18849 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18850 | /* convert from MIX nid to DAC */ |
| 18851 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18852 | { |
| 18853 | if (nid == 0x0f) |
| 18854 | return 0x02; |
| 18855 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18856 | return nid - 0x0c + 0x02; |
| 18857 | else |
| 18858 | return 0; |
| 18859 | } |
| 18860 | |
| 18861 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18862 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18863 | hda_nid_t dac) |
| 18864 | { |
| 18865 | hda_nid_t mix[4]; |
| 18866 | int i, num; |
| 18867 | |
| 18868 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18869 | for (i = 0; i < num; i++) { |
| 18870 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18871 | return mix[i]; |
| 18872 | } |
| 18873 | return 0; |
| 18874 | } |
| 18875 | |
| 18876 | /* look for an empty DAC slot */ |
| 18877 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18878 | { |
| 18879 | struct alc_spec *spec = codec->spec; |
| 18880 | hda_nid_t srcs[5]; |
| 18881 | int i, j, num; |
| 18882 | |
| 18883 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18884 | if (num < 0) |
| 18885 | return 0; |
| 18886 | for (i = 0; i < num; i++) { |
| 18887 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18888 | if (!nid) |
| 18889 | continue; |
| 18890 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18891 | if (spec->multiout.dac_nids[j] == nid) |
| 18892 | break; |
| 18893 | if (j >= spec->multiout.num_dacs) |
| 18894 | return nid; |
| 18895 | } |
| 18896 | return 0; |
| 18897 | } |
| 18898 | |
| 18899 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18900 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18901 | const struct auto_pin_cfg *cfg) |
| 18902 | { |
| 18903 | struct alc_spec *spec = codec->spec; |
| 18904 | int i; |
| 18905 | hda_nid_t dac; |
| 18906 | |
| 18907 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18908 | for (i = 0; i < cfg->line_outs; i++) { |
| 18909 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18910 | if (!dac) |
| 18911 | continue; |
| 18912 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18913 | } |
| 18914 | return 0; |
| 18915 | } |
| 18916 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18917 | 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] | 18918 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18919 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18920 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18921 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18922 | } |
| 18923 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18924 | 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] | 18925 | hda_nid_t nid, unsigned int chs) |
| 18926 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18927 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18928 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18929 | } |
| 18930 | |
| 18931 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18932 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18933 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18934 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18935 | |
| 18936 | /* add playback controls from the parsed DAC table */ |
| 18937 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18938 | const struct auto_pin_cfg *cfg) |
| 18939 | { |
| 18940 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18941 | static const char *chname[4] = { |
| 18942 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18943 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18944 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18945 | int i, err; |
| 18946 | |
| 18947 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18948 | nid = spec->multiout.dac_nids[i]; |
| 18949 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18950 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18951 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18952 | if (!mix) |
| 18953 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18954 | if (i == 2) { |
| 18955 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18956 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18957 | if (err < 0) |
| 18958 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18959 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18960 | if (err < 0) |
| 18961 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18962 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18963 | if (err < 0) |
| 18964 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18965 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18966 | if (err < 0) |
| 18967 | return err; |
| 18968 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18969 | const char *pfx; |
| 18970 | if (cfg->line_outs == 1 && |
| 18971 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18972 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18973 | pfx = "Speaker"; |
| 18974 | else |
| 18975 | pfx = "PCM"; |
| 18976 | } else |
| 18977 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18978 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18979 | if (err < 0) |
| 18980 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18981 | if (cfg->line_outs == 1 && |
| 18982 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18983 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18984 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18985 | if (err < 0) |
| 18986 | return err; |
| 18987 | } |
| 18988 | } |
| 18989 | return 0; |
| 18990 | } |
| 18991 | |
| 18992 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18993 | /* return DAC nid if any new DAC is assigned */ |
| 18994 | 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] | 18995 | const char *pfx) |
| 18996 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18997 | struct alc_spec *spec = codec->spec; |
| 18998 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18999 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19000 | |
| 19001 | if (!pin) |
| 19002 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19003 | nid = alc662_look_for_dac(codec, pin); |
| 19004 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19005 | /* the corresponding DAC is already occupied */ |
| 19006 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19007 | return 0; /* no way */ |
| 19008 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19009 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19010 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19011 | } |
| 19012 | |
| 19013 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19014 | if (!mix) |
| 19015 | return 0; |
| 19016 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19017 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19018 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19019 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19020 | if (err < 0) |
| 19021 | return err; |
| 19022 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19023 | } |
| 19024 | |
| 19025 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19026 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19027 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19028 | |
| 19029 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19030 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19031 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19032 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19033 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19034 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19035 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19036 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19037 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19038 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19039 | if (num <= 1) |
| 19040 | return; |
| 19041 | for (i = 0; i < num; i++) { |
| 19042 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19043 | continue; |
| 19044 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19045 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19046 | } |
| 19047 | } |
| 19048 | |
| 19049 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19050 | { |
| 19051 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19052 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19053 | int i; |
| 19054 | |
| 19055 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19056 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19057 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19058 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19059 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19060 | } |
| 19061 | } |
| 19062 | |
| 19063 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19064 | { |
| 19065 | struct alc_spec *spec = codec->spec; |
| 19066 | hda_nid_t pin; |
| 19067 | |
| 19068 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19069 | if (pin) |
| 19070 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19071 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19072 | pin = spec->autocfg.speaker_pins[0]; |
| 19073 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19074 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19075 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19076 | } |
| 19077 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19078 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19079 | |
| 19080 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19081 | { |
| 19082 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19083 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19084 | int i; |
| 19085 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19086 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19087 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19088 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame^] | 19089 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19090 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19091 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19092 | snd_hda_codec_write(codec, nid, 0, |
| 19093 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19094 | AMP_OUT_MUTE); |
| 19095 | } |
| 19096 | } |
| 19097 | } |
| 19098 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19099 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19100 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19101 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19102 | { |
| 19103 | struct alc_spec *spec = codec->spec; |
| 19104 | int err; |
| 19105 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19106 | |
| 19107 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19108 | alc662_ignore); |
| 19109 | if (err < 0) |
| 19110 | return err; |
| 19111 | if (!spec->autocfg.line_outs) |
| 19112 | return 0; /* can't find valid BIOS pin config */ |
| 19113 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19114 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19115 | if (err < 0) |
| 19116 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19117 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19118 | if (err < 0) |
| 19119 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19120 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19121 | spec->autocfg.speaker_pins[0], |
| 19122 | "Speaker"); |
| 19123 | if (err < 0) |
| 19124 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19125 | if (err) |
| 19126 | spec->multiout.extra_out_nid[0] = err; |
| 19127 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19128 | "Headphone"); |
| 19129 | if (err < 0) |
| 19130 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19131 | if (err) |
| 19132 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19133 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19134 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19135 | return err; |
| 19136 | |
| 19137 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19138 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19139 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19140 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19141 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19142 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19143 | |
| 19144 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19145 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19146 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19147 | add_verb(spec, alc662_init_verbs); |
| 19148 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19149 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19150 | add_verb(spec, alc663_init_verbs); |
| 19151 | |
| 19152 | if (codec->vendor_id == 0x10ec0272) |
| 19153 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19154 | |
| 19155 | err = alc_auto_add_mic_boost(codec); |
| 19156 | if (err < 0) |
| 19157 | return err; |
| 19158 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19159 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19160 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19161 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19162 | else |
| 19163 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19164 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19165 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19166 | } |
| 19167 | |
| 19168 | /* additional initialization for auto-configuration model */ |
| 19169 | static void alc662_auto_init(struct hda_codec *codec) |
| 19170 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19171 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19172 | alc662_auto_init_multi_out(codec); |
| 19173 | alc662_auto_init_hp_out(codec); |
| 19174 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19175 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19176 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19177 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19178 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19179 | } |
| 19180 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19181 | enum { |
| 19182 | ALC662_FIXUP_IDEAPAD, |
| 19183 | }; |
| 19184 | |
| 19185 | static const struct alc_fixup alc662_fixups[] = { |
| 19186 | [ALC662_FIXUP_IDEAPAD] = { |
| 19187 | .pins = (const struct alc_pincfg[]) { |
| 19188 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19189 | { } |
| 19190 | } |
| 19191 | }, |
| 19192 | }; |
| 19193 | |
| 19194 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
| 19195 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19196 | {} |
| 19197 | }; |
| 19198 | |
| 19199 | |
| 19200 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19201 | static int patch_alc662(struct hda_codec *codec) |
| 19202 | { |
| 19203 | struct alc_spec *spec; |
| 19204 | int err, board_config; |
| 19205 | |
| 19206 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19207 | if (!spec) |
| 19208 | return -ENOMEM; |
| 19209 | |
| 19210 | codec->spec = spec; |
| 19211 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19212 | alc_auto_parse_customize_define(codec); |
| 19213 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19214 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19215 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19216 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 19217 | alc_codec_rename(codec, "ALC661"); |
| 19218 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 19219 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19220 | spec->cdefine.platform_type == 1) |
| 19221 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19222 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19223 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19224 | alc662_models, |
| 19225 | alc662_cfg_tbl); |
| 19226 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19227 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19228 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19229 | board_config = ALC662_AUTO; |
| 19230 | } |
| 19231 | |
| 19232 | if (board_config == ALC662_AUTO) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19233 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19234 | /* automatic parse from the BIOS config */ |
| 19235 | err = alc662_parse_auto_config(codec); |
| 19236 | if (err < 0) { |
| 19237 | alc_free(codec); |
| 19238 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19239 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19240 | printk(KERN_INFO |
| 19241 | "hda_codec: Cannot set up configuration " |
| 19242 | "from BIOS. Using base mode...\n"); |
| 19243 | board_config = ALC662_3ST_2ch_DIG; |
| 19244 | } |
| 19245 | } |
| 19246 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19247 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19248 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19249 | if (err < 0) { |
| 19250 | alc_free(codec); |
| 19251 | return err; |
| 19252 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19253 | } |
| 19254 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19255 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19256 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19257 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19258 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19259 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19260 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19261 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19262 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19263 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19264 | if (!spec->adc_nids) { |
| 19265 | spec->adc_nids = alc662_adc_nids; |
| 19266 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19267 | } |
| 19268 | if (!spec->capsrc_nids) |
| 19269 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19270 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19271 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19272 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19273 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19274 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19275 | switch (codec->vendor_id) { |
| 19276 | case 0x10ec0662: |
| 19277 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19278 | break; |
| 19279 | case 0x10ec0272: |
| 19280 | case 0x10ec0663: |
| 19281 | case 0x10ec0665: |
| 19282 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19283 | break; |
| 19284 | case 0x10ec0273: |
| 19285 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19286 | break; |
| 19287 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19288 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19289 | spec->vmaster_nid = 0x02; |
| 19290 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19291 | codec->patch_ops = alc_patch_ops; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19292 | if (board_config == ALC662_AUTO) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19293 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19294 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
| 19295 | } |
| 19296 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19297 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19298 | if (!spec->loopback.amplist) |
| 19299 | spec->loopback.amplist = alc662_loopbacks; |
| 19300 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19301 | |
| 19302 | return 0; |
| 19303 | } |
| 19304 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19305 | static int patch_alc888(struct hda_codec *codec) |
| 19306 | { |
| 19307 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19308 | kfree(codec->chip_name); |
| 19309 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19310 | if (!codec->chip_name) { |
| 19311 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19312 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19313 | } |
| 19314 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19315 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19316 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19317 | } |
| 19318 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19319 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19320 | * ALC680 support |
| 19321 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19322 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19323 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19324 | #define alc680_modes alc260_modes |
| 19325 | |
| 19326 | static hda_nid_t alc680_dac_nids[3] = { |
| 19327 | /* Lout1, Lout2, hp */ |
| 19328 | 0x02, 0x03, 0x04 |
| 19329 | }; |
| 19330 | |
| 19331 | static hda_nid_t alc680_adc_nids[3] = { |
| 19332 | /* ADC0-2 */ |
| 19333 | /* DMIC, MIC, Line-in*/ |
| 19334 | 0x07, 0x08, 0x09 |
| 19335 | }; |
| 19336 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19337 | /* |
| 19338 | * Analog capture ADC cgange |
| 19339 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19340 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19341 | { |
| 19342 | struct alc_spec *spec = codec->spec; |
| 19343 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19344 | int pin_found = 0; |
| 19345 | int type_found = AUTO_PIN_LAST; |
| 19346 | hda_nid_t nid; |
| 19347 | int i; |
| 19348 | |
| 19349 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19350 | nid = cfg->inputs[i].pin; |
| 19351 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19352 | AC_PINCAP_PRES_DETECT)) |
| 19353 | continue; |
| 19354 | if (snd_hda_jack_detect(codec, nid)) { |
| 19355 | if (cfg->inputs[i].type < type_found) { |
| 19356 | type_found = cfg->inputs[i].type; |
| 19357 | pin_found = nid; |
| 19358 | } |
| 19359 | } |
| 19360 | } |
| 19361 | |
| 19362 | nid = 0x07; |
| 19363 | if (pin_found) |
| 19364 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19365 | |
| 19366 | if (nid != spec->cur_adc) |
| 19367 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19368 | spec->cur_adc = nid; |
| 19369 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19370 | spec->cur_adc_format); |
| 19371 | } |
| 19372 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19373 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19374 | struct hda_codec *codec, |
| 19375 | unsigned int stream_tag, |
| 19376 | unsigned int format, |
| 19377 | struct snd_pcm_substream *substream) |
| 19378 | { |
| 19379 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19380 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19381 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19382 | spec->cur_adc_stream_tag = stream_tag; |
| 19383 | spec->cur_adc_format = format; |
| 19384 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19385 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19386 | return 0; |
| 19387 | } |
| 19388 | |
| 19389 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19390 | struct hda_codec *codec, |
| 19391 | struct snd_pcm_substream *substream) |
| 19392 | { |
| 19393 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19394 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19395 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19396 | return 0; |
| 19397 | } |
| 19398 | |
| 19399 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19400 | .substreams = 1, /* can be overridden */ |
| 19401 | .channels_min = 2, |
| 19402 | .channels_max = 2, |
| 19403 | /* NID is set in alc_build_pcms */ |
| 19404 | .ops = { |
| 19405 | .prepare = alc680_capture_pcm_prepare, |
| 19406 | .cleanup = alc680_capture_pcm_cleanup |
| 19407 | }, |
| 19408 | }; |
| 19409 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19410 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19411 | /* output mixer control */ |
| 19412 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19413 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19414 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19415 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19416 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19417 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19418 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19419 | { } |
| 19420 | }; |
| 19421 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19422 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19423 | .ops = &snd_hda_bind_vol, |
| 19424 | .values = { |
| 19425 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19426 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19427 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19428 | 0 |
| 19429 | }, |
| 19430 | }; |
| 19431 | |
| 19432 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19433 | .ops = &snd_hda_bind_sw, |
| 19434 | .values = { |
| 19435 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19436 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19437 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19438 | 0 |
| 19439 | }, |
| 19440 | }; |
| 19441 | |
| 19442 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19443 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19444 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19445 | { } /* end */ |
| 19446 | }; |
| 19447 | |
| 19448 | /* |
| 19449 | * generic initialization of ADC, input mixers and output mixers |
| 19450 | */ |
| 19451 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19452 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19453 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19454 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19455 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19456 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19457 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19458 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19459 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19460 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19461 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19462 | |
| 19463 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19464 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19465 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19466 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19467 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19468 | |
| 19469 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19470 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19471 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19472 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19473 | { } |
| 19474 | }; |
| 19475 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19476 | /* toggle speaker-output according to the hp-jack state */ |
| 19477 | static void alc680_base_setup(struct hda_codec *codec) |
| 19478 | { |
| 19479 | struct alc_spec *spec = codec->spec; |
| 19480 | |
| 19481 | spec->autocfg.hp_pins[0] = 0x16; |
| 19482 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19483 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19484 | spec->autocfg.num_inputs = 2; |
| 19485 | spec->autocfg.inputs[0].pin = 0x18; |
| 19486 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19487 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19488 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19489 | } |
| 19490 | |
| 19491 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19492 | unsigned int res) |
| 19493 | { |
| 19494 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19495 | alc_automute_amp(codec); |
| 19496 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19497 | alc680_rec_autoswitch(codec); |
| 19498 | } |
| 19499 | |
| 19500 | static void alc680_inithook(struct hda_codec *codec) |
| 19501 | { |
| 19502 | alc_automute_amp(codec); |
| 19503 | alc680_rec_autoswitch(codec); |
| 19504 | } |
| 19505 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19506 | /* create input playback/capture controls for the given pin */ |
| 19507 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19508 | const char *ctlname, int idx) |
| 19509 | { |
| 19510 | hda_nid_t dac; |
| 19511 | int err; |
| 19512 | |
| 19513 | switch (nid) { |
| 19514 | case 0x14: |
| 19515 | dac = 0x02; |
| 19516 | break; |
| 19517 | case 0x15: |
| 19518 | dac = 0x03; |
| 19519 | break; |
| 19520 | case 0x16: |
| 19521 | dac = 0x04; |
| 19522 | break; |
| 19523 | default: |
| 19524 | return 0; |
| 19525 | } |
| 19526 | if (spec->multiout.dac_nids[0] != dac && |
| 19527 | spec->multiout.dac_nids[1] != dac) { |
| 19528 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19529 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19530 | HDA_OUTPUT)); |
| 19531 | if (err < 0) |
| 19532 | return err; |
| 19533 | |
| 19534 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19535 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19536 | |
| 19537 | if (err < 0) |
| 19538 | return err; |
| 19539 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19540 | } |
| 19541 | |
| 19542 | return 0; |
| 19543 | } |
| 19544 | |
| 19545 | /* add playback controls from the parsed DAC table */ |
| 19546 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19547 | const struct auto_pin_cfg *cfg) |
| 19548 | { |
| 19549 | hda_nid_t nid; |
| 19550 | int err; |
| 19551 | |
| 19552 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19553 | |
| 19554 | nid = cfg->line_out_pins[0]; |
| 19555 | if (nid) { |
| 19556 | const char *name; |
| 19557 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19558 | name = "Speaker"; |
| 19559 | else |
| 19560 | name = "Front"; |
| 19561 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19562 | if (err < 0) |
| 19563 | return err; |
| 19564 | } |
| 19565 | |
| 19566 | nid = cfg->speaker_pins[0]; |
| 19567 | if (nid) { |
| 19568 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19569 | if (err < 0) |
| 19570 | return err; |
| 19571 | } |
| 19572 | nid = cfg->hp_pins[0]; |
| 19573 | if (nid) { |
| 19574 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19575 | if (err < 0) |
| 19576 | return err; |
| 19577 | } |
| 19578 | |
| 19579 | return 0; |
| 19580 | } |
| 19581 | |
| 19582 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19583 | hda_nid_t nid, int pin_type) |
| 19584 | { |
| 19585 | alc_set_pin_output(codec, nid, pin_type); |
| 19586 | } |
| 19587 | |
| 19588 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19589 | { |
| 19590 | struct alc_spec *spec = codec->spec; |
| 19591 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19592 | if (nid) { |
| 19593 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19594 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19595 | } |
| 19596 | } |
| 19597 | |
| 19598 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19599 | { |
| 19600 | struct alc_spec *spec = codec->spec; |
| 19601 | hda_nid_t pin; |
| 19602 | |
| 19603 | pin = spec->autocfg.hp_pins[0]; |
| 19604 | if (pin) |
| 19605 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19606 | pin = spec->autocfg.speaker_pins[0]; |
| 19607 | if (pin) |
| 19608 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19609 | } |
| 19610 | |
| 19611 | /* pcm configuration: identical with ALC880 */ |
| 19612 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19613 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19614 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19615 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19616 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19617 | |
| 19618 | /* |
| 19619 | * BIOS auto configuration |
| 19620 | */ |
| 19621 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19622 | { |
| 19623 | struct alc_spec *spec = codec->spec; |
| 19624 | int err; |
| 19625 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19626 | |
| 19627 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19628 | alc680_ignore); |
| 19629 | if (err < 0) |
| 19630 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19631 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19632 | if (!spec->autocfg.line_outs) { |
| 19633 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19634 | spec->multiout.max_channels = 2; |
| 19635 | spec->no_analog = 1; |
| 19636 | goto dig_only; |
| 19637 | } |
| 19638 | return 0; /* can't find valid BIOS pin config */ |
| 19639 | } |
| 19640 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19641 | if (err < 0) |
| 19642 | return err; |
| 19643 | |
| 19644 | spec->multiout.max_channels = 2; |
| 19645 | |
| 19646 | dig_only: |
| 19647 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19648 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19649 | if (spec->kctls.list) |
| 19650 | add_mixer(spec, spec->kctls.list); |
| 19651 | |
| 19652 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19653 | |
| 19654 | err = alc_auto_add_mic_boost(codec); |
| 19655 | if (err < 0) |
| 19656 | return err; |
| 19657 | |
| 19658 | return 1; |
| 19659 | } |
| 19660 | |
| 19661 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19662 | |
| 19663 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19664 | static void alc680_auto_init(struct hda_codec *codec) |
| 19665 | { |
| 19666 | struct alc_spec *spec = codec->spec; |
| 19667 | alc680_auto_init_multi_out(codec); |
| 19668 | alc680_auto_init_hp_out(codec); |
| 19669 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19670 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19671 | if (spec->unsol_event) |
| 19672 | alc_inithook(codec); |
| 19673 | } |
| 19674 | |
| 19675 | /* |
| 19676 | * configuration and preset |
| 19677 | */ |
| 19678 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19679 | [ALC680_BASE] = "base", |
| 19680 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19681 | }; |
| 19682 | |
| 19683 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19684 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19685 | {} |
| 19686 | }; |
| 19687 | |
| 19688 | static struct alc_config_preset alc680_presets[] = { |
| 19689 | [ALC680_BASE] = { |
| 19690 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19691 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19692 | .init_verbs = { alc680_init_verbs }, |
| 19693 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19694 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19695 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19696 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19697 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19698 | .unsol_event = alc680_unsol_event, |
| 19699 | .setup = alc680_base_setup, |
| 19700 | .init_hook = alc680_inithook, |
| 19701 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19702 | }, |
| 19703 | }; |
| 19704 | |
| 19705 | static int patch_alc680(struct hda_codec *codec) |
| 19706 | { |
| 19707 | struct alc_spec *spec; |
| 19708 | int board_config; |
| 19709 | int err; |
| 19710 | |
| 19711 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19712 | if (spec == NULL) |
| 19713 | return -ENOMEM; |
| 19714 | |
| 19715 | codec->spec = spec; |
| 19716 | |
| 19717 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19718 | alc680_models, |
| 19719 | alc680_cfg_tbl); |
| 19720 | |
| 19721 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19722 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19723 | codec->chip_name); |
| 19724 | board_config = ALC680_AUTO; |
| 19725 | } |
| 19726 | |
| 19727 | if (board_config == ALC680_AUTO) { |
| 19728 | /* automatic parse from the BIOS config */ |
| 19729 | err = alc680_parse_auto_config(codec); |
| 19730 | if (err < 0) { |
| 19731 | alc_free(codec); |
| 19732 | return err; |
| 19733 | } else if (!err) { |
| 19734 | printk(KERN_INFO |
| 19735 | "hda_codec: Cannot set up configuration " |
| 19736 | "from BIOS. Using base mode...\n"); |
| 19737 | board_config = ALC680_BASE; |
| 19738 | } |
| 19739 | } |
| 19740 | |
| 19741 | if (board_config != ALC680_AUTO) |
| 19742 | setup_preset(codec, &alc680_presets[board_config]); |
| 19743 | |
| 19744 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19745 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19746 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19747 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19748 | |
| 19749 | if (!spec->adc_nids) { |
| 19750 | spec->adc_nids = alc680_adc_nids; |
| 19751 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19752 | } |
| 19753 | |
| 19754 | if (!spec->cap_mixer) |
| 19755 | set_capture_mixer(codec); |
| 19756 | |
| 19757 | spec->vmaster_nid = 0x02; |
| 19758 | |
| 19759 | codec->patch_ops = alc_patch_ops; |
| 19760 | if (board_config == ALC680_AUTO) |
| 19761 | spec->init_hook = alc680_auto_init; |
| 19762 | |
| 19763 | return 0; |
| 19764 | } |
| 19765 | |
| 19766 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19767 | * patch entries |
| 19768 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19769 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19770 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19771 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19772 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19773 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19774 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19775 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19776 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19777 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19778 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19779 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19780 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19781 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19782 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19783 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19784 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19785 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19786 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19787 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19788 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19789 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19790 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19791 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19792 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19793 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19794 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19795 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19796 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19797 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19798 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19799 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19800 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19801 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19802 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19803 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19804 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19805 | {} /* terminator */ |
| 19806 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19807 | |
| 19808 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19809 | |
| 19810 | MODULE_LICENSE("GPL"); |
| 19811 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19812 | |
| 19813 | static struct hda_codec_preset_list realtek_list = { |
| 19814 | .preset = snd_hda_preset_realtek, |
| 19815 | .owner = THIS_MODULE, |
| 19816 | }; |
| 19817 | |
| 19818 | static int __init patch_realtek_init(void) |
| 19819 | { |
| 19820 | return snd_hda_add_codec_preset(&realtek_list); |
| 19821 | } |
| 19822 | |
| 19823 | static void __exit patch_realtek_exit(void) |
| 19824 | { |
| 19825 | snd_hda_delete_codec_preset(&realtek_list); |
| 19826 | } |
| 19827 | |
| 19828 | module_init(patch_realtek_init) |
| 19829 | module_exit(patch_realtek_exit) |