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 | 7cf51e4 | 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 | 7cf51e4 | 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 | bab282b | 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 | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 256 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550 | 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 | 4953550 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 4b35d2c | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5163 | alc_set_input_pin(codec, nid, i); |
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 | c8b6bf9b | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6796 | alc_set_input_pin(codec, nid, i); |
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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | c8b6bf9b | 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 | a3f730a | 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 | 96fe7cc | 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 | 96fe7cc | 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 | 96fe7cc | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | 4953550 | 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 | 4953550 | 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 | 3e1647c | 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 | 3e1647c | 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 | 3e1647c | 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 | 3e1647c | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9655 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | bab282b | 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 | bab282b | 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 | bab282b | 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 | 3e1647c | 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 | 3e1647c | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 4953550 | 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 | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10637 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10638 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10639 | if (pin) { |
| 10640 | dac = spec->multiout.hp_nid; |
| 10641 | if (!dac) |
| 10642 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10643 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10644 | } |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10645 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10646 | if (pin) { |
| 10647 | dac = spec->multiout.extra_out_nid[0]; |
| 10648 | if (!dac) |
| 10649 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10650 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10651 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10652 | } |
| 10653 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10654 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10655 | { |
| 10656 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10657 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10658 | int i; |
| 10659 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10660 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10661 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10662 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10663 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10664 | snd_hda_codec_write(codec, nid, 0, |
| 10665 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10666 | AMP_OUT_MUTE); |
| 10667 | } |
| 10668 | } |
| 10669 | |
| 10670 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10671 | { |
| 10672 | struct alc_spec *spec = codec->spec; |
| 10673 | int c; |
| 10674 | |
| 10675 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10676 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10677 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10678 | unsigned int mux_idx; |
| 10679 | const struct hda_input_mux *imux; |
| 10680 | int conns, mute, idx, item; |
| 10681 | |
| 10682 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10683 | ARRAY_SIZE(conn_list)); |
| 10684 | if (conns < 0) |
| 10685 | continue; |
| 10686 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10687 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10688 | if (!imux->num_items && mux_idx > 0) |
| 10689 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10690 | for (idx = 0; idx < conns; idx++) { |
| 10691 | /* if the current connection is the selected one, |
| 10692 | * unmute it as default - otherwise mute it |
| 10693 | */ |
| 10694 | mute = AMP_IN_MUTE(idx); |
| 10695 | for (item = 0; item < imux->num_items; item++) { |
| 10696 | if (imux->items[item].index == idx) { |
| 10697 | if (spec->cur_mux[c] == item) |
| 10698 | mute = AMP_IN_UNMUTE(idx); |
| 10699 | break; |
| 10700 | } |
| 10701 | } |
| 10702 | /* check if we have a selector or mixer |
| 10703 | * we could check for the widget type instead, but |
| 10704 | * just check for Amp-In presence (in case of mixer |
| 10705 | * without amp-in there is something wrong, this |
| 10706 | * function shouldn't be used or capsrc nid is wrong) |
| 10707 | */ |
| 10708 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10709 | snd_hda_codec_write(codec, nid, 0, |
| 10710 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10711 | mute); |
| 10712 | else if (mute != AMP_IN_MUTE(idx)) |
| 10713 | snd_hda_codec_write(codec, nid, 0, |
| 10714 | AC_VERB_SET_CONNECT_SEL, |
| 10715 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10716 | } |
| 10717 | } |
| 10718 | } |
| 10719 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10720 | /* add mic boosts if needed */ |
| 10721 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10722 | { |
| 10723 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10724 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 10725 | int i, err; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10726 | hda_nid_t nid; |
| 10727 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10728 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10729 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10730 | break; |
| 10731 | nid = cfg->inputs[i].pin; |
| 10732 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 10733 | char label[32]; |
| 10734 | snprintf(label, sizeof(label), "%s Boost", |
| 10735 | hda_get_autocfg_input_label(codec, cfg, i)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10736 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10737 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10738 | if (err < 0) |
| 10739 | return err; |
| 10740 | } |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10741 | } |
| 10742 | return 0; |
| 10743 | } |
| 10744 | |
| 10745 | /* almost identical with ALC880 parser... */ |
| 10746 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10747 | { |
| 10748 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10749 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10750 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10751 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10752 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10753 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10754 | if (err < 0) |
| 10755 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10756 | if (!spec->autocfg.line_outs) |
| 10757 | return 0; /* can't find valid BIOS pin config */ |
| 10758 | |
| 10759 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10760 | if (err < 0) |
| 10761 | return err; |
| 10762 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10763 | if (err < 0) |
| 10764 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10765 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10766 | "Headphone"); |
| 10767 | if (err < 0) |
| 10768 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10769 | err = alc880_auto_create_extra_out(spec, |
| 10770 | spec->autocfg.speaker_pins[0], |
| 10771 | "Speaker"); |
| 10772 | if (err < 0) |
| 10773 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10774 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10775 | if (err < 0) |
| 10776 | return err; |
| 10777 | |
| 10778 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10779 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10780 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10781 | |
| 10782 | if (spec->kctls.list) |
| 10783 | add_mixer(spec, spec->kctls.list); |
| 10784 | |
| 10785 | add_verb(spec, alc883_auto_init_verbs); |
| 10786 | /* if ADC 0x07 is available, initialize it, too */ |
| 10787 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10788 | add_verb(spec, alc882_adc1_init_verbs); |
| 10789 | |
| 10790 | spec->num_mux_defs = 1; |
| 10791 | spec->input_mux = &spec->private_imux[0]; |
| 10792 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10793 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10794 | |
| 10795 | err = alc_auto_add_mic_boost(codec); |
| 10796 | if (err < 0) |
| 10797 | return err; |
| 10798 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10799 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10800 | } |
| 10801 | |
| 10802 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10803 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10804 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10805 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10806 | alc882_auto_init_multi_out(codec); |
| 10807 | alc882_auto_init_hp_out(codec); |
| 10808 | alc882_auto_init_analog_input(codec); |
| 10809 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10810 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10811 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10812 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10813 | } |
| 10814 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10815 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10816 | { |
| 10817 | struct alc_spec *spec; |
| 10818 | int err, board_config; |
| 10819 | |
| 10820 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10821 | if (spec == NULL) |
| 10822 | return -ENOMEM; |
| 10823 | |
| 10824 | codec->spec = spec; |
| 10825 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10826 | alc_auto_parse_customize_define(codec); |
| 10827 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10828 | switch (codec->vendor_id) { |
| 10829 | case 0x10ec0882: |
| 10830 | case 0x10ec0885: |
| 10831 | break; |
| 10832 | default: |
| 10833 | /* ALC883 and variants */ |
| 10834 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10835 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10836 | } |
| 10837 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10838 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10839 | alc882_models, |
| 10840 | alc882_cfg_tbl); |
| 10841 | |
| 10842 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10843 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10844 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10845 | |
| 10846 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10847 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10848 | codec->chip_name); |
| 10849 | board_config = ALC882_AUTO; |
| 10850 | } |
| 10851 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10852 | if (board_config == ALC882_AUTO) |
| 10853 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10854 | |
| 10855 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10856 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10857 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10858 | if (err < 0) { |
| 10859 | alc_free(codec); |
| 10860 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10861 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10862 | printk(KERN_INFO |
| 10863 | "hda_codec: Cannot set up configuration " |
| 10864 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10865 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10866 | } |
| 10867 | } |
| 10868 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10869 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10870 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10871 | if (err < 0) { |
| 10872 | alc_free(codec); |
| 10873 | return err; |
| 10874 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10875 | } |
| 10876 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10877 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10878 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10879 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10880 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10881 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10882 | /* FIXME: setup DAC5 */ |
| 10883 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10884 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10885 | |
| 10886 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10887 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10888 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10889 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10890 | int i, j; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10891 | spec->num_adc_nids = 0; |
| 10892 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10893 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10894 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10895 | hda_nid_t items[16]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10896 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10897 | unsigned int wcap = get_wcaps(codec, nid); |
| 10898 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10899 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10900 | if (wcap != AC_WID_AUD_IN) |
| 10901 | continue; |
| 10902 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10903 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10904 | if (err < 0) |
| 10905 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10906 | err = snd_hda_get_connections(codec, cap, items, |
| 10907 | ARRAY_SIZE(items)); |
| 10908 | if (err < 0) |
| 10909 | continue; |
| 10910 | for (j = 0; j < imux->num_items; j++) |
| 10911 | if (imux->items[j].index >= err) |
| 10912 | break; |
| 10913 | if (j < imux->num_items) |
| 10914 | continue; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10915 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10916 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10917 | } |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10918 | spec->adc_nids = spec->private_adc_nids; |
| 10919 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10920 | } |
| 10921 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10922 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10923 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10924 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10925 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10926 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10927 | if (board_config == ALC882_AUTO) |
| 10928 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10929 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10930 | spec->vmaster_nid = 0x0c; |
| 10931 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10932 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10933 | if (board_config == ALC882_AUTO) |
| 10934 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10935 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10936 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10937 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10938 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10939 | |
| 10940 | return 0; |
| 10941 | } |
| 10942 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10943 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10944 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10945 | * ALC262 support |
| 10946 | */ |
| 10947 | |
| 10948 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10949 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10950 | |
| 10951 | #define alc262_dac_nids alc260_dac_nids |
| 10952 | #define alc262_adc_nids alc882_adc_nids |
| 10953 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10954 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10955 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10956 | |
| 10957 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10958 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10959 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10960 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10961 | /* ADC0 */ |
| 10962 | 0x09 |
| 10963 | }; |
| 10964 | |
| 10965 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10966 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10967 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10968 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10969 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10970 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10971 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10972 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10973 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10974 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10976 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10977 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10978 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10979 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10980 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10981 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10982 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10983 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10984 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10985 | }; |
| 10986 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10987 | /* update HP, line and mono-out pins according to the master switch */ |
| 10988 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10989 | { |
| 10990 | struct alc_spec *spec = codec->spec; |
| 10991 | int val = spec->master_sw; |
| 10992 | |
| 10993 | /* HP & line-out */ |
| 10994 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10995 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10996 | val ? PIN_HP : 0); |
| 10997 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10998 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10999 | val ? PIN_HP : 0); |
| 11000 | /* mono (speaker) depending on the HP jack sense */ |
| 11001 | val = val && !spec->jack_present; |
| 11002 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11003 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11004 | val ? PIN_OUT : 0); |
| 11005 | } |
| 11006 | |
| 11007 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11008 | { |
| 11009 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11010 | |
| 11011 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11012 | alc262_hp_master_update(codec); |
| 11013 | } |
| 11014 | |
| 11015 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11016 | { |
| 11017 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11018 | return; |
| 11019 | alc262_hp_bpc_automute(codec); |
| 11020 | } |
| 11021 | |
| 11022 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11023 | { |
| 11024 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11025 | |
| 11026 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11027 | alc262_hp_master_update(codec); |
| 11028 | } |
| 11029 | |
| 11030 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11031 | unsigned int res) |
| 11032 | { |
| 11033 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11034 | return; |
| 11035 | alc262_hp_wildwest_automute(codec); |
| 11036 | } |
| 11037 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11038 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11039 | |
| 11040 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11041 | struct snd_ctl_elem_value *ucontrol) |
| 11042 | { |
| 11043 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11044 | struct alc_spec *spec = codec->spec; |
| 11045 | int val = !!*ucontrol->value.integer.value; |
| 11046 | |
| 11047 | if (val == spec->master_sw) |
| 11048 | return 0; |
| 11049 | spec->master_sw = val; |
| 11050 | alc262_hp_master_update(codec); |
| 11051 | return 1; |
| 11052 | } |
| 11053 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11054 | #define ALC262_HP_MASTER_SWITCH \ |
| 11055 | { \ |
| 11056 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11057 | .name = "Master Playback Switch", \ |
| 11058 | .info = snd_ctl_boolean_mono_info, \ |
| 11059 | .get = alc262_hp_master_sw_get, \ |
| 11060 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11061 | }, \ |
| 11062 | { \ |
| 11063 | .iface = NID_MAPPING, \ |
| 11064 | .name = "Master Playback Switch", \ |
| 11065 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11066 | } |
| 11067 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11068 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11069 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11070 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11072 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11073 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11074 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11075 | HDA_OUTPUT), |
| 11076 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11077 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11078 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11079 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11080 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11081 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11082 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11083 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11085 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11086 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11087 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11088 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11089 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11090 | { } /* end */ |
| 11091 | }; |
| 11092 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11093 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11094 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11095 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11096 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11097 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11098 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11099 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11100 | HDA_OUTPUT), |
| 11101 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11102 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11103 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11104 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11105 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11106 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11107 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11108 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11109 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11110 | { } /* end */ |
| 11111 | }; |
| 11112 | |
| 11113 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11114 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11115 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11116 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11117 | { } /* end */ |
| 11118 | }; |
| 11119 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11120 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11121 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11122 | { |
| 11123 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11124 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11125 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11126 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11127 | } |
| 11128 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11129 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11130 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11131 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11133 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11134 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11135 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11136 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11137 | { } /* end */ |
| 11138 | }; |
| 11139 | |
| 11140 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11141 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11143 | |
| 11144 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11145 | { } |
| 11146 | }; |
| 11147 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11148 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11149 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11150 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11151 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11152 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11153 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11154 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11155 | { } /* end */ |
| 11156 | }; |
| 11157 | |
| 11158 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11159 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11160 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11161 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11162 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11163 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11164 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11165 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11166 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11167 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11168 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11169 | {} |
| 11170 | }; |
| 11171 | |
| 11172 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11173 | .num_items = 1, |
| 11174 | .items = { |
| 11175 | { "Line", 0x1 }, |
| 11176 | }, |
| 11177 | }; |
| 11178 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11179 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11180 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11181 | { |
| 11182 | struct alc_spec *spec = codec->spec; |
| 11183 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11184 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11185 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11186 | unsigned int mute; |
| 11187 | |
| 11188 | /* HP */ |
| 11189 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11190 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11191 | HDA_AMP_MUTE, mute); |
| 11192 | /* mute internal speaker per jack sense */ |
| 11193 | if (spec->jack_present) |
| 11194 | mute = HDA_AMP_MUTE; |
| 11195 | if (line_nid) |
| 11196 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11197 | HDA_AMP_MUTE, mute); |
| 11198 | if (speaker_nid && speaker_nid != line_nid) |
| 11199 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11200 | HDA_AMP_MUTE, mute); |
| 11201 | } |
| 11202 | |
| 11203 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11204 | |
| 11205 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11206 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11207 | { |
| 11208 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11209 | struct alc_spec *spec = codec->spec; |
| 11210 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11211 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11212 | if (val == spec->master_sw) |
| 11213 | return 0; |
| 11214 | spec->master_sw = val; |
| 11215 | alc262_hippo_master_update(codec); |
| 11216 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11217 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11218 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11219 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11220 | { \ |
| 11221 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11222 | .name = "Master Playback Switch", \ |
| 11223 | .info = snd_ctl_boolean_mono_info, \ |
| 11224 | .get = alc262_hippo_master_sw_get, \ |
| 11225 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11226 | }, \ |
| 11227 | { \ |
| 11228 | .iface = NID_MAPPING, \ |
| 11229 | .name = "Master Playback Switch", \ |
| 11230 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11231 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11232 | } |
| 11233 | |
| 11234 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11235 | ALC262_HIPPO_MASTER_SWITCH, |
| 11236 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11237 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11238 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11239 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11240 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11241 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11242 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11243 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11244 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11245 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11246 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11247 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11248 | { } /* end */ |
| 11249 | }; |
| 11250 | |
| 11251 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11252 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11253 | ALC262_HIPPO_MASTER_SWITCH, |
| 11254 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11255 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11256 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11257 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11258 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11259 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11260 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11261 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11262 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11263 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11264 | { } /* end */ |
| 11265 | }; |
| 11266 | |
| 11267 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11268 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11269 | { |
| 11270 | struct alc_spec *spec = codec->spec; |
| 11271 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11272 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11273 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11274 | alc262_hippo_master_update(codec); |
| 11275 | } |
| 11276 | |
| 11277 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11278 | { |
| 11279 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11280 | return; |
| 11281 | alc262_hippo_automute(codec); |
| 11282 | } |
| 11283 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11284 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11285 | { |
| 11286 | struct alc_spec *spec = codec->spec; |
| 11287 | |
| 11288 | spec->autocfg.hp_pins[0] = 0x15; |
| 11289 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11290 | } |
| 11291 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11292 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11293 | { |
| 11294 | struct alc_spec *spec = codec->spec; |
| 11295 | |
| 11296 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11297 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11298 | } |
| 11299 | |
| 11300 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11301 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11302 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11303 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11306 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11307 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11308 | { } /* end */ |
| 11309 | }; |
| 11310 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11311 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11312 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11313 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11314 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11315 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11316 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11317 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11318 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11319 | { } /* end */ |
| 11320 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11321 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11322 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11323 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11324 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11325 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11326 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11327 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11328 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11329 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11331 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11332 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11333 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11334 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11335 | { } /* end */ |
| 11336 | }; |
| 11337 | |
| 11338 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11339 | /* Headphone automute */ |
| 11340 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11341 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11342 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11343 | |
| 11344 | /* P11 AUX_IN, white 4-pin connector */ |
| 11345 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11346 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11347 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11348 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11349 | |
| 11350 | {} |
| 11351 | }; |
| 11352 | |
| 11353 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11354 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11355 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11356 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11357 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11358 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11359 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11360 | } |
| 11361 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11362 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11363 | #define alc262_capture_mixer alc882_capture_mixer |
| 11364 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11365 | |
| 11366 | /* |
| 11367 | * generic initialization of ADC, input mixers and output mixers |
| 11368 | */ |
| 11369 | static struct hda_verb alc262_init_verbs[] = { |
| 11370 | /* |
| 11371 | * Unmute ADC0-2 and set the default input to mic-in |
| 11372 | */ |
| 11373 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11374 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11375 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11376 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11377 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11378 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11379 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11380 | /* 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] | 11381 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11382 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11383 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11384 | */ |
| 11385 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11387 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11391 | |
| 11392 | /* |
| 11393 | * Set up output mixers (0x0c - 0x0e) |
| 11394 | */ |
| 11395 | /* set vol=0 to output mixers */ |
| 11396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11399 | /* set up input amps for analog loopback */ |
| 11400 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11401 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11403 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11404 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11405 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11406 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11407 | |
| 11408 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11410 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11411 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11412 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11413 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11414 | |
| 11415 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11416 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11417 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11418 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11419 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11420 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11421 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11422 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11424 | /* FIXME: use matrix-type input source selection */ |
| 11425 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11426 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11427 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11428 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11429 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11430 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11431 | /* Input mixer2 */ |
| 11432 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11433 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11434 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11435 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11436 | /* Input mixer3 */ |
| 11437 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11438 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11439 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11440 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11441 | |
| 11442 | { } |
| 11443 | }; |
| 11444 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11445 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11446 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11447 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11448 | { } |
| 11449 | }; |
| 11450 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11451 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11452 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11453 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11454 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11455 | |
| 11456 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11457 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11458 | {} |
| 11459 | }; |
| 11460 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11461 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11462 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11463 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11464 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11465 | |
| 11466 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11467 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11468 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11469 | }; |
| 11470 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11471 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11472 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11473 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11474 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11475 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11476 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11477 | { } /* end */ |
| 11478 | }; |
| 11479 | |
| 11480 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11481 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11482 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11483 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11484 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11485 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11486 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11487 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11488 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11489 | {} |
| 11490 | }; |
| 11491 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11492 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11493 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11494 | struct alc_spec *spec = codec->spec; |
| 11495 | |
| 11496 | spec->autocfg.hp_pins[0] = 0x15; |
| 11497 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11498 | spec->ext_mic.pin = 0x18; |
| 11499 | spec->ext_mic.mux_idx = 0; |
| 11500 | spec->int_mic.pin = 0x12; |
| 11501 | spec->int_mic.mux_idx = 9; |
| 11502 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11503 | } |
| 11504 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11505 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11506 | * nec model |
| 11507 | * 0x15 = headphone |
| 11508 | * 0x16 = internal speaker |
| 11509 | * 0x18 = external mic |
| 11510 | */ |
| 11511 | |
| 11512 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11513 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11514 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11515 | |
| 11516 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11517 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11518 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11519 | |
| 11520 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11521 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11522 | { } /* end */ |
| 11523 | }; |
| 11524 | |
| 11525 | static struct hda_verb alc262_nec_verbs[] = { |
| 11526 | /* Unmute Speaker */ |
| 11527 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11528 | |
| 11529 | /* Headphone */ |
| 11530 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11531 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11532 | |
| 11533 | /* External mic to headphone */ |
| 11534 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11535 | /* External mic to speaker */ |
| 11536 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11537 | {} |
| 11538 | }; |
| 11539 | |
| 11540 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11541 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11542 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11543 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11544 | */ |
| 11545 | |
| 11546 | #define ALC_HP_EVENT 0x37 |
| 11547 | |
| 11548 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11549 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11550 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11551 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11552 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11553 | {} |
| 11554 | }; |
| 11555 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11556 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11557 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11558 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11559 | {} |
| 11560 | }; |
| 11561 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11562 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11563 | /* Front Mic pin: input vref at 50% */ |
| 11564 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11565 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11566 | {} |
| 11567 | }; |
| 11568 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11569 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11570 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11571 | .items = { |
| 11572 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11573 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11574 | { "CD", 0x4 }, |
| 11575 | }, |
| 11576 | }; |
| 11577 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11578 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11579 | .num_items = 5, |
| 11580 | .items = { |
| 11581 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11582 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11583 | { "Line", 0x2 }, |
| 11584 | { "CD", 0x4 }, |
| 11585 | { "AUX IN", 0x6 }, |
| 11586 | }, |
| 11587 | }; |
| 11588 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11589 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11590 | .num_items = 4, |
| 11591 | .items = { |
| 11592 | { "Mic", 0x0 }, |
| 11593 | { "Front Mic", 0x2 }, |
| 11594 | { "Line", 0x1 }, |
| 11595 | { "CD", 0x4 }, |
| 11596 | }, |
| 11597 | }; |
| 11598 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11599 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11600 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11601 | { |
| 11602 | struct alc_spec *spec = codec->spec; |
| 11603 | unsigned int mute; |
| 11604 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11605 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11606 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11607 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11608 | spec->sense_updated = 1; |
| 11609 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11610 | /* unmute internal speaker only if both HPs are unplugged and |
| 11611 | * master switch is on |
| 11612 | */ |
| 11613 | if (spec->jack_present) |
| 11614 | mute = HDA_AMP_MUTE; |
| 11615 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11616 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11617 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11618 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11619 | } |
| 11620 | |
| 11621 | /* unsolicited event for HP jack sensing */ |
| 11622 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11623 | unsigned int res) |
| 11624 | { |
| 11625 | if ((res >> 26) != ALC_HP_EVENT) |
| 11626 | return; |
| 11627 | alc262_fujitsu_automute(codec, 1); |
| 11628 | } |
| 11629 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11630 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11631 | { |
| 11632 | alc262_fujitsu_automute(codec, 1); |
| 11633 | } |
| 11634 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11635 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11636 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11637 | .ops = &snd_hda_bind_vol, |
| 11638 | .values = { |
| 11639 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11640 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11641 | 0 |
| 11642 | }, |
| 11643 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11644 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11645 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11646 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11647 | { |
| 11648 | struct alc_spec *spec = codec->spec; |
| 11649 | unsigned int mute; |
| 11650 | |
| 11651 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11652 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11653 | spec->sense_updated = 1; |
| 11654 | } |
| 11655 | if (spec->jack_present) { |
| 11656 | /* mute internal speaker */ |
| 11657 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11658 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11659 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11660 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11661 | } else { |
| 11662 | /* unmute internal speaker if necessary */ |
| 11663 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11664 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11665 | HDA_AMP_MUTE, mute); |
| 11666 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11667 | HDA_AMP_MUTE, mute); |
| 11668 | } |
| 11669 | } |
| 11670 | |
| 11671 | /* unsolicited event for HP jack sensing */ |
| 11672 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11673 | unsigned int res) |
| 11674 | { |
| 11675 | if ((res >> 26) != ALC_HP_EVENT) |
| 11676 | return; |
| 11677 | alc262_lenovo_3000_automute(codec, 1); |
| 11678 | } |
| 11679 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11680 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11681 | int dir, int idx, long *valp) |
| 11682 | { |
| 11683 | int i, change = 0; |
| 11684 | |
| 11685 | for (i = 0; i < 2; i++, valp++) |
| 11686 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11687 | HDA_AMP_MUTE, |
| 11688 | *valp ? 0 : HDA_AMP_MUTE); |
| 11689 | return change; |
| 11690 | } |
| 11691 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11692 | /* bind hp and internal speaker mute (with plug check) */ |
| 11693 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11694 | struct snd_ctl_elem_value *ucontrol) |
| 11695 | { |
| 11696 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11697 | long *valp = ucontrol->value.integer.value; |
| 11698 | int change; |
| 11699 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11700 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11701 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11702 | if (change) |
| 11703 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11704 | return change; |
| 11705 | } |
| 11706 | |
| 11707 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11708 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11709 | { |
| 11710 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11711 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11712 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11713 | .info = snd_hda_mixer_amp_switch_info, |
| 11714 | .get = snd_hda_mixer_amp_switch_get, |
| 11715 | .put = alc262_fujitsu_master_sw_put, |
| 11716 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11717 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11718 | { |
| 11719 | .iface = NID_MAPPING, |
| 11720 | .name = "Master Playback Switch", |
| 11721 | .private_value = 0x1b, |
| 11722 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11724 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11725 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11726 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11727 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11728 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11729 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11730 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11731 | { } /* end */ |
| 11732 | }; |
| 11733 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11734 | /* bind hp and internal speaker mute (with plug check) */ |
| 11735 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11736 | struct snd_ctl_elem_value *ucontrol) |
| 11737 | { |
| 11738 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11739 | long *valp = ucontrol->value.integer.value; |
| 11740 | int change; |
| 11741 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11742 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11743 | if (change) |
| 11744 | alc262_lenovo_3000_automute(codec, 0); |
| 11745 | return change; |
| 11746 | } |
| 11747 | |
| 11748 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11749 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11750 | { |
| 11751 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11752 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11753 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11754 | .info = snd_hda_mixer_amp_switch_info, |
| 11755 | .get = snd_hda_mixer_amp_switch_get, |
| 11756 | .put = alc262_lenovo_3000_master_sw_put, |
| 11757 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11758 | }, |
| 11759 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11760 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11761 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11763 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11764 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11765 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11766 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11767 | { } /* end */ |
| 11768 | }; |
| 11769 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11770 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11771 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11772 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11774 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11775 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11776 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11777 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11778 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11779 | { } /* end */ |
| 11780 | }; |
| 11781 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11782 | /* additional init verbs for Benq laptops */ |
| 11783 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11784 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11785 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11786 | {} |
| 11787 | }; |
| 11788 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11789 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11790 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11791 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11792 | |
| 11793 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11794 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11795 | {} |
| 11796 | }; |
| 11797 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11798 | /* Samsung Q1 Ultra Vista model setup */ |
| 11799 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11800 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11801 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11802 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11804 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11805 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11806 | { } /* end */ |
| 11807 | }; |
| 11808 | |
| 11809 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11810 | /* output mixer */ |
| 11811 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11814 | /* speaker */ |
| 11815 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11816 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11817 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11818 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11819 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11820 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11821 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11822 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11823 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11824 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11825 | /* internal mic */ |
| 11826 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11827 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11828 | /* ADC, choose mic */ |
| 11829 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11830 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11831 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11832 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11833 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11834 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11835 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11836 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11837 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11838 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11839 | {} |
| 11840 | }; |
| 11841 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11842 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11843 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11844 | { |
| 11845 | struct alc_spec *spec = codec->spec; |
| 11846 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11847 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11848 | mute = 0; |
| 11849 | /* auto-mute only when HP is used as HP */ |
| 11850 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11851 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11852 | if (spec->jack_present) |
| 11853 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11854 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11855 | /* mute/unmute internal speaker */ |
| 11856 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11857 | HDA_AMP_MUTE, mute); |
| 11858 | /* mute/unmute HP */ |
| 11859 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11860 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11861 | } |
| 11862 | |
| 11863 | /* unsolicited event for HP jack sensing */ |
| 11864 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11865 | unsigned int res) |
| 11866 | { |
| 11867 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11868 | return; |
| 11869 | alc262_ultra_automute(codec); |
| 11870 | } |
| 11871 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11872 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11873 | .num_items = 2, |
| 11874 | .items = { |
| 11875 | { "Mic", 0x1 }, |
| 11876 | { "Headphone", 0x7 }, |
| 11877 | }, |
| 11878 | }; |
| 11879 | |
| 11880 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11881 | struct snd_ctl_elem_value *ucontrol) |
| 11882 | { |
| 11883 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11884 | struct alc_spec *spec = codec->spec; |
| 11885 | int ret; |
| 11886 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11887 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11888 | if (!ret) |
| 11889 | return 0; |
| 11890 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11891 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11892 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11893 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11894 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11895 | return ret; |
| 11896 | } |
| 11897 | |
| 11898 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11899 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11900 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11901 | { |
| 11902 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11903 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11904 | .info = alc_mux_enum_info, |
| 11905 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11906 | .put = alc262_ultra_mux_enum_put, |
| 11907 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11908 | { |
| 11909 | .iface = NID_MAPPING, |
| 11910 | .name = "Capture Source", |
| 11911 | .private_value = 0x15, |
| 11912 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11913 | { } /* end */ |
| 11914 | }; |
| 11915 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11916 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11917 | * and thus it's bound with a different mixer. |
| 11918 | * This function returns which mixer amp should be used. |
| 11919 | */ |
| 11920 | static int alc262_check_volbit(hda_nid_t nid) |
| 11921 | { |
| 11922 | if (!nid) |
| 11923 | return 0; |
| 11924 | else if (nid == 0x16) |
| 11925 | return 2; |
| 11926 | else |
| 11927 | return 1; |
| 11928 | } |
| 11929 | |
| 11930 | 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] | 11931 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11932 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11933 | unsigned long val; |
| 11934 | int vbit; |
| 11935 | |
| 11936 | vbit = alc262_check_volbit(nid); |
| 11937 | if (!vbit) |
| 11938 | return 0; |
| 11939 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11940 | return 0; |
| 11941 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11942 | if (vbit == 2) |
| 11943 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11944 | else |
| 11945 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11946 | 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] | 11947 | } |
| 11948 | |
| 11949 | 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] | 11950 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11951 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11952 | unsigned long val; |
| 11953 | |
| 11954 | if (!nid) |
| 11955 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11956 | if (nid == 0x16) |
| 11957 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11958 | else |
| 11959 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11960 | 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] | 11961 | } |
| 11962 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11963 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11964 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11965 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11966 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11967 | const char *pfx; |
| 11968 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11969 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11970 | |
| 11971 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11972 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11973 | spec->multiout.dac_nids[0] = 2; |
| 11974 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11975 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11976 | pfx = "Master"; |
| 11977 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11978 | pfx = "Speaker"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11979 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) |
| 11980 | pfx = "Headphone"; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11981 | else |
| 11982 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11983 | for (i = 0; i < 2; i++) { |
| 11984 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 11985 | if (err < 0) |
| 11986 | return err; |
| 11987 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11988 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 11989 | "Speaker", i); |
| 11990 | if (err < 0) |
| 11991 | return err; |
| 11992 | } |
| 11993 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 11994 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 11995 | "Headphone", i); |
| 11996 | if (err < 0) |
| 11997 | return err; |
| 11998 | } |
| 11999 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12000 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12001 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12002 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12003 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12004 | if (vbits == 1 || vbits == 2) |
| 12005 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12006 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12007 | for (i = 0; i < 2; i++) { |
| 12008 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12009 | &vbits, i); |
| 12010 | if (err < 0) |
| 12011 | return err; |
| 12012 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12013 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12014 | "Speaker", &vbits, i); |
| 12015 | if (err < 0) |
| 12016 | return err; |
| 12017 | } |
| 12018 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12019 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12020 | "Headphone", &vbits, i); |
| 12021 | if (err < 0) |
| 12022 | return err; |
| 12023 | } |
| 12024 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12025 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12026 | } |
| 12027 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12028 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12029 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12030 | |
| 12031 | /* |
| 12032 | * generic initialization of ADC, input mixers and output mixers |
| 12033 | */ |
| 12034 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12035 | /* |
| 12036 | * Unmute ADC0-2 and set the default input to mic-in |
| 12037 | */ |
| 12038 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12039 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12040 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12041 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12042 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12043 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12044 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12045 | /* 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] | 12046 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12047 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12048 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12049 | */ |
| 12050 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12051 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12052 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12053 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12054 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12055 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12056 | |
| 12057 | /* |
| 12058 | * Set up output mixers (0x0c - 0x0f) |
| 12059 | */ |
| 12060 | /* set vol=0 to output mixers */ |
| 12061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12062 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12063 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12064 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12065 | /* set up input amps for analog loopback */ |
| 12066 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12067 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12068 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12069 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12070 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12072 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12073 | |
| 12074 | /* FIXME: use matrix-type input source selection */ |
| 12075 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12076 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12077 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12078 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12079 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12080 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12081 | /* Input mixer2 */ |
| 12082 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12083 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12084 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12085 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12086 | /* Input mixer3 */ |
| 12087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12089 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12090 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12091 | |
| 12092 | { } |
| 12093 | }; |
| 12094 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12095 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12096 | /* |
| 12097 | * Unmute ADC0-2 and set the default input to mic-in |
| 12098 | */ |
| 12099 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12100 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12101 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12102 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12103 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12104 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12105 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12106 | /* 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] | 12107 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12108 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12109 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12110 | */ |
| 12111 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12119 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12120 | /* |
| 12121 | * Set up output mixers (0x0c - 0x0e) |
| 12122 | */ |
| 12123 | /* set vol=0 to output mixers */ |
| 12124 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12125 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12126 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12127 | |
| 12128 | /* set up input amps for analog loopback */ |
| 12129 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12131 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12132 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12133 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12134 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12135 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12136 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12137 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12138 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12139 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12140 | |
| 12141 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12142 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12143 | |
| 12144 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12145 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12146 | |
| 12147 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12148 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12149 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12150 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12151 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12152 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12153 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12154 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12155 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12156 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12157 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12158 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12159 | |
| 12160 | |
| 12161 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12162 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12163 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12164 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12165 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12166 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12167 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12168 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12169 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12170 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12171 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12172 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12173 | /* Input mixer2 */ |
| 12174 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12175 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12176 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12177 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12178 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12180 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12181 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12182 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12183 | /* Input mixer3 */ |
| 12184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12186 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12187 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12188 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12193 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12194 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12195 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12196 | { } |
| 12197 | }; |
| 12198 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12199 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12200 | /* |
| 12201 | * Unmute ADC0-2 and set the default input to mic-in |
| 12202 | */ |
| 12203 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12204 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12205 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12206 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12207 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12208 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12209 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12210 | /* 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] | 12211 | * mixer widget |
| 12212 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12213 | * panel mic (mic 2) |
| 12214 | */ |
| 12215 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12216 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12217 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12222 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12223 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12224 | /* |
| 12225 | * Set up output mixers (0x0c - 0x0e) |
| 12226 | */ |
| 12227 | /* set vol=0 to output mixers */ |
| 12228 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12229 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12230 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12231 | |
| 12232 | /* set up input amps for analog loopback */ |
| 12233 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12235 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12236 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12237 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12238 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12239 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12240 | |
| 12241 | |
| 12242 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12243 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12244 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12245 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12246 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12247 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12248 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12249 | |
| 12250 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12251 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12252 | |
| 12253 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12254 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12255 | |
| 12256 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12257 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12258 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12259 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12260 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12261 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12262 | |
| 12263 | /* FIXME: use matrix-type input source selection */ |
| 12264 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12265 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12266 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12267 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12268 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12269 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12270 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12271 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12272 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12273 | /* Input mixer2 */ |
| 12274 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12275 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12276 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12277 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12278 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12279 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12280 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12281 | /* Input mixer3 */ |
| 12282 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12283 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12284 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12285 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12286 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12287 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12288 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12289 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12290 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12291 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12292 | { } |
| 12293 | }; |
| 12294 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12295 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12296 | |
| 12297 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12298 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12299 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12300 | |
| 12301 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12302 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12303 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12304 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12305 | |
| 12306 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12307 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12308 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12309 | {} |
| 12310 | }; |
| 12311 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12312 | /* |
| 12313 | * Pin config fixes |
| 12314 | */ |
| 12315 | enum { |
| 12316 | PINFIX_FSC_H270, |
| 12317 | }; |
| 12318 | |
| 12319 | static const struct alc_fixup alc262_fixups[] = { |
| 12320 | [PINFIX_FSC_H270] = { |
| 12321 | .pins = (const struct alc_pincfg[]) { |
| 12322 | { 0x14, 0x99130110 }, /* speaker */ |
| 12323 | { 0x15, 0x0221142f }, /* front HP */ |
| 12324 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12325 | { } |
| 12326 | } |
| 12327 | }, |
| 12328 | [PINFIX_PB_M5210] = { |
| 12329 | .verbs = (const struct hda_verb[]) { |
| 12330 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 12331 | {} |
| 12332 | } |
| 12333 | }, |
| 12334 | }; |
| 12335 | |
| 12336 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12337 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12338 | {} |
| 12339 | }; |
| 12340 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12341 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12342 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12343 | #define alc262_loopbacks alc880_loopbacks |
| 12344 | #endif |
| 12345 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12346 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12347 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12348 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12349 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12350 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12351 | |
| 12352 | /* |
| 12353 | * BIOS auto configuration |
| 12354 | */ |
| 12355 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12356 | { |
| 12357 | struct alc_spec *spec = codec->spec; |
| 12358 | int err; |
| 12359 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12360 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12361 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12362 | alc262_ignore); |
| 12363 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12364 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12365 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12366 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12367 | spec->multiout.max_channels = 2; |
| 12368 | spec->no_analog = 1; |
| 12369 | goto dig_only; |
| 12370 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12371 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12372 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12373 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12374 | if (err < 0) |
| 12375 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12376 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12377 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12378 | return err; |
| 12379 | |
| 12380 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12381 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12382 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12383 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12384 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12385 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12386 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12387 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12388 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12389 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12390 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12391 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12392 | err = alc_auto_add_mic_boost(codec); |
| 12393 | if (err < 0) |
| 12394 | return err; |
| 12395 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12396 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12397 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12398 | return 1; |
| 12399 | } |
| 12400 | |
| 12401 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12402 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12403 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12404 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12405 | |
| 12406 | |
| 12407 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12408 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12409 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12410 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12411 | alc262_auto_init_multi_out(codec); |
| 12412 | alc262_auto_init_hp_out(codec); |
| 12413 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12414 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12415 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12416 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12417 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12418 | } |
| 12419 | |
| 12420 | /* |
| 12421 | * configuration and preset |
| 12422 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12423 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12424 | [ALC262_BASIC] = "basic", |
| 12425 | [ALC262_HIPPO] = "hippo", |
| 12426 | [ALC262_HIPPO_1] = "hippo_1", |
| 12427 | [ALC262_FUJITSU] = "fujitsu", |
| 12428 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12429 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12430 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12431 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12432 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12433 | [ALC262_BENQ_T31] = "benq-t31", |
| 12434 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12435 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12436 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12437 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12438 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12439 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12440 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12441 | [ALC262_AUTO] = "auto", |
| 12442 | }; |
| 12443 | |
| 12444 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12445 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12446 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12447 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12448 | ALC262_HP_BPC), |
| 12449 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12450 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12451 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12452 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12453 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12454 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12455 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12456 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12457 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12458 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12459 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12460 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12461 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12462 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12463 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12464 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12465 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12466 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12467 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12468 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12469 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12470 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12471 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12472 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12473 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12474 | #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] | 12475 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12476 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12477 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12478 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12479 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12480 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12481 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12482 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12483 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12484 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12485 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12486 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12487 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12488 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12489 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12490 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12491 | {} |
| 12492 | }; |
| 12493 | |
| 12494 | static struct alc_config_preset alc262_presets[] = { |
| 12495 | [ALC262_BASIC] = { |
| 12496 | .mixers = { alc262_base_mixer }, |
| 12497 | .init_verbs = { alc262_init_verbs }, |
| 12498 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12499 | .dac_nids = alc262_dac_nids, |
| 12500 | .hp_nid = 0x03, |
| 12501 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12502 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12503 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12504 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12505 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12506 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12507 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12508 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12509 | .dac_nids = alc262_dac_nids, |
| 12510 | .hp_nid = 0x03, |
| 12511 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12512 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12513 | .channel_mode = alc262_modes, |
| 12514 | .input_mux = &alc262_capture_source, |
| 12515 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12516 | .setup = alc262_hippo_setup, |
| 12517 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12518 | }, |
| 12519 | [ALC262_HIPPO_1] = { |
| 12520 | .mixers = { alc262_hippo1_mixer }, |
| 12521 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12522 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12523 | .dac_nids = alc262_dac_nids, |
| 12524 | .hp_nid = 0x02, |
| 12525 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12526 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12527 | .channel_mode = alc262_modes, |
| 12528 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12529 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12530 | .setup = alc262_hippo1_setup, |
| 12531 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12532 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12533 | [ALC262_FUJITSU] = { |
| 12534 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12535 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12536 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12537 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12538 | .dac_nids = alc262_dac_nids, |
| 12539 | .hp_nid = 0x03, |
| 12540 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12541 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12542 | .channel_mode = alc262_modes, |
| 12543 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12544 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12545 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12546 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12547 | [ALC262_HP_BPC] = { |
| 12548 | .mixers = { alc262_HP_BPC_mixer }, |
| 12549 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12550 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12551 | .dac_nids = alc262_dac_nids, |
| 12552 | .hp_nid = 0x03, |
| 12553 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12554 | .channel_mode = alc262_modes, |
| 12555 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12556 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12557 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12558 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12559 | [ALC262_HP_BPC_D7000_WF] = { |
| 12560 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12561 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12562 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12563 | .dac_nids = alc262_dac_nids, |
| 12564 | .hp_nid = 0x03, |
| 12565 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12566 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12567 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12568 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12569 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12570 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12571 | [ALC262_HP_BPC_D7000_WL] = { |
| 12572 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12573 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12574 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12575 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12576 | .dac_nids = alc262_dac_nids, |
| 12577 | .hp_nid = 0x03, |
| 12578 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12579 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12580 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12581 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12582 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12583 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12584 | [ALC262_HP_TC_T5735] = { |
| 12585 | .mixers = { alc262_hp_t5735_mixer }, |
| 12586 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12587 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12588 | .dac_nids = alc262_dac_nids, |
| 12589 | .hp_nid = 0x03, |
| 12590 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12591 | .channel_mode = alc262_modes, |
| 12592 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12593 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12594 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12595 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12596 | }, |
| 12597 | [ALC262_HP_RP5700] = { |
| 12598 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12599 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12600 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12601 | .dac_nids = alc262_dac_nids, |
| 12602 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12603 | .channel_mode = alc262_modes, |
| 12604 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12605 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12606 | [ALC262_BENQ_ED8] = { |
| 12607 | .mixers = { alc262_base_mixer }, |
| 12608 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12609 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12610 | .dac_nids = alc262_dac_nids, |
| 12611 | .hp_nid = 0x03, |
| 12612 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12613 | .channel_mode = alc262_modes, |
| 12614 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12615 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12616 | [ALC262_SONY_ASSAMD] = { |
| 12617 | .mixers = { alc262_sony_mixer }, |
| 12618 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12619 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12620 | .dac_nids = alc262_dac_nids, |
| 12621 | .hp_nid = 0x02, |
| 12622 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12623 | .channel_mode = alc262_modes, |
| 12624 | .input_mux = &alc262_capture_source, |
| 12625 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12626 | .setup = alc262_hippo_setup, |
| 12627 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12628 | }, |
| 12629 | [ALC262_BENQ_T31] = { |
| 12630 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12631 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12632 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12633 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12634 | .dac_nids = alc262_dac_nids, |
| 12635 | .hp_nid = 0x03, |
| 12636 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12637 | .channel_mode = alc262_modes, |
| 12638 | .input_mux = &alc262_capture_source, |
| 12639 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12640 | .setup = alc262_hippo_setup, |
| 12641 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12642 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12643 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12644 | .mixers = { alc262_ultra_mixer }, |
| 12645 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12646 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12647 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12648 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12649 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12650 | .channel_mode = alc262_modes, |
| 12651 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12652 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12653 | .capsrc_nids = alc262_capsrc_nids, |
| 12654 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12655 | .unsol_event = alc262_ultra_unsol_event, |
| 12656 | .init_hook = alc262_ultra_automute, |
| 12657 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12658 | [ALC262_LENOVO_3000] = { |
| 12659 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12660 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12661 | alc262_lenovo_3000_unsol_verbs, |
| 12662 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12663 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12664 | .dac_nids = alc262_dac_nids, |
| 12665 | .hp_nid = 0x03, |
| 12666 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12667 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12668 | .channel_mode = alc262_modes, |
| 12669 | .input_mux = &alc262_fujitsu_capture_source, |
| 12670 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12671 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12672 | [ALC262_NEC] = { |
| 12673 | .mixers = { alc262_nec_mixer }, |
| 12674 | .init_verbs = { alc262_nec_verbs }, |
| 12675 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12676 | .dac_nids = alc262_dac_nids, |
| 12677 | .hp_nid = 0x03, |
| 12678 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12679 | .channel_mode = alc262_modes, |
| 12680 | .input_mux = &alc262_capture_source, |
| 12681 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12682 | [ALC262_TOSHIBA_S06] = { |
| 12683 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12684 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12685 | alc262_eapd_verbs }, |
| 12686 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12687 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12688 | .dac_nids = alc262_dac_nids, |
| 12689 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12690 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12691 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12692 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12693 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12694 | .unsol_event = alc_sku_unsol_event, |
| 12695 | .setup = alc262_toshiba_s06_setup, |
| 12696 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12697 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12698 | [ALC262_TOSHIBA_RX1] = { |
| 12699 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12700 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12701 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12702 | .dac_nids = alc262_dac_nids, |
| 12703 | .hp_nid = 0x03, |
| 12704 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12705 | .channel_mode = alc262_modes, |
| 12706 | .input_mux = &alc262_capture_source, |
| 12707 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12708 | .setup = alc262_hippo_setup, |
| 12709 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12710 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12711 | [ALC262_TYAN] = { |
| 12712 | .mixers = { alc262_tyan_mixer }, |
| 12713 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12714 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12715 | .dac_nids = alc262_dac_nids, |
| 12716 | .hp_nid = 0x02, |
| 12717 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12718 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12719 | .channel_mode = alc262_modes, |
| 12720 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12721 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12722 | .setup = alc262_tyan_setup, |
| 12723 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12724 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12725 | }; |
| 12726 | |
| 12727 | static int patch_alc262(struct hda_codec *codec) |
| 12728 | { |
| 12729 | struct alc_spec *spec; |
| 12730 | int board_config; |
| 12731 | int err; |
| 12732 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12733 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12734 | if (spec == NULL) |
| 12735 | return -ENOMEM; |
| 12736 | |
| 12737 | codec->spec = spec; |
| 12738 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12739 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12740 | * under-run |
| 12741 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12742 | { |
| 12743 | int tmp; |
| 12744 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12745 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12746 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12747 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12748 | } |
| 12749 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12750 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12751 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12752 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12753 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12754 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12755 | alc262_models, |
| 12756 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12757 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12758 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12759 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12760 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12761 | board_config = ALC262_AUTO; |
| 12762 | } |
| 12763 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12764 | if (board_config == ALC262_AUTO) |
| 12765 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); |
| 12766 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12767 | if (board_config == ALC262_AUTO) { |
| 12768 | /* automatic parse from the BIOS config */ |
| 12769 | err = alc262_parse_auto_config(codec); |
| 12770 | if (err < 0) { |
| 12771 | alc_free(codec); |
| 12772 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12773 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12774 | printk(KERN_INFO |
| 12775 | "hda_codec: Cannot set up configuration " |
| 12776 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12777 | board_config = ALC262_BASIC; |
| 12778 | } |
| 12779 | } |
| 12780 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12781 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12782 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12783 | if (err < 0) { |
| 12784 | alc_free(codec); |
| 12785 | return err; |
| 12786 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12787 | } |
| 12788 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12789 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12790 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12791 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12792 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12793 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12794 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12795 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12796 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12797 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12798 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12799 | int i; |
| 12800 | /* check whether the digital-mic has to be supported */ |
| 12801 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12802 | if (spec->input_mux->items[i].index >= 9) |
| 12803 | break; |
| 12804 | } |
| 12805 | if (i < spec->input_mux->num_items) { |
| 12806 | /* use only ADC0 */ |
| 12807 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12808 | spec->num_adc_nids = 1; |
| 12809 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12810 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12811 | /* all analog inputs */ |
| 12812 | /* check whether NID 0x07 is valid */ |
| 12813 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12814 | |
| 12815 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12816 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12817 | if (wcap != AC_WID_AUD_IN) { |
| 12818 | spec->adc_nids = alc262_adc_nids_alt; |
| 12819 | spec->num_adc_nids = |
| 12820 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12821 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12822 | } else { |
| 12823 | spec->adc_nids = alc262_adc_nids; |
| 12824 | spec->num_adc_nids = |
| 12825 | ARRAY_SIZE(alc262_adc_nids); |
| 12826 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12827 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12828 | } |
| 12829 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12830 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12831 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12832 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12833 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12834 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12835 | if (board_config == ALC262_AUTO) |
| 12836 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); |
| 12837 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12838 | spec->vmaster_nid = 0x0c; |
| 12839 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12840 | codec->patch_ops = alc_patch_ops; |
| 12841 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12842 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12843 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12844 | if (!spec->loopback.amplist) |
| 12845 | spec->loopback.amplist = alc262_loopbacks; |
| 12846 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12847 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12848 | return 0; |
| 12849 | } |
| 12850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12851 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12852 | * ALC268 channel source setting (2 channel) |
| 12853 | */ |
| 12854 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12855 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12856 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12857 | static hda_nid_t alc268_dac_nids[2] = { |
| 12858 | /* front, hp */ |
| 12859 | 0x02, 0x03 |
| 12860 | }; |
| 12861 | |
| 12862 | static hda_nid_t alc268_adc_nids[2] = { |
| 12863 | /* ADC0-1 */ |
| 12864 | 0x08, 0x07 |
| 12865 | }; |
| 12866 | |
| 12867 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12868 | /* ADC0 */ |
| 12869 | 0x08 |
| 12870 | }; |
| 12871 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12872 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12873 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12874 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12875 | /* output mixer control */ |
| 12876 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12877 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12878 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12881 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12882 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12883 | { } |
| 12884 | }; |
| 12885 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12886 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12887 | /* output mixer control */ |
| 12888 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12889 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12890 | ALC262_HIPPO_MASTER_SWITCH, |
| 12891 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12892 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12893 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12894 | { } |
| 12895 | }; |
| 12896 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12897 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12898 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12899 | .ops = &snd_hda_bind_sw, |
| 12900 | .values = { |
| 12901 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12902 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12903 | 0 |
| 12904 | }, |
| 12905 | }; |
| 12906 | |
| 12907 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12908 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12909 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12910 | { } |
| 12911 | }; |
| 12912 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12913 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12914 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12915 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12916 | { } |
| 12917 | }; |
| 12918 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12919 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12920 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12921 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12922 | { } /* end */ |
| 12923 | }; |
| 12924 | |
| 12925 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12926 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12927 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12928 | .ops = &snd_hda_bind_vol, |
| 12929 | .values = { |
| 12930 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12931 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12932 | 0 |
| 12933 | }, |
| 12934 | }; |
| 12935 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12936 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12937 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12938 | { |
| 12939 | struct alc_spec *spec = codec->spec; |
| 12940 | unsigned int mute; |
| 12941 | |
| 12942 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12943 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12944 | spec->sense_updated = 1; |
| 12945 | } |
| 12946 | if (spec->jack_present) |
| 12947 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12948 | else /* unmute internal speaker if necessary */ |
| 12949 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12950 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12951 | HDA_AMP_MUTE, mute); |
| 12952 | } |
| 12953 | |
| 12954 | |
| 12955 | /* bind hp and internal speaker mute (with plug check) */ |
| 12956 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12957 | struct snd_ctl_elem_value *ucontrol) |
| 12958 | { |
| 12959 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12960 | long *valp = ucontrol->value.integer.value; |
| 12961 | int change; |
| 12962 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12963 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12964 | if (change) |
| 12965 | alc268_acer_automute(codec, 0); |
| 12966 | return change; |
| 12967 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12968 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12969 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12970 | /* output mixer control */ |
| 12971 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12972 | { |
| 12973 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12974 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12975 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12976 | .info = snd_hda_mixer_amp_switch_info, |
| 12977 | .get = snd_hda_mixer_amp_switch_get, |
| 12978 | .put = alc268_acer_master_sw_put, |
| 12979 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12980 | }, |
| 12981 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12982 | { } |
| 12983 | }; |
| 12984 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12985 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12986 | /* output mixer control */ |
| 12987 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12988 | { |
| 12989 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12990 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12991 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12992 | .info = snd_hda_mixer_amp_switch_info, |
| 12993 | .get = snd_hda_mixer_amp_switch_get, |
| 12994 | .put = alc268_acer_master_sw_put, |
| 12995 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12996 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12997 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12998 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12999 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13000 | { } |
| 13001 | }; |
| 13002 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13003 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13004 | /* output mixer control */ |
| 13005 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13006 | { |
| 13007 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13008 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13009 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13010 | .info = snd_hda_mixer_amp_switch_info, |
| 13011 | .get = snd_hda_mixer_amp_switch_get, |
| 13012 | .put = alc268_acer_master_sw_put, |
| 13013 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13014 | }, |
| 13015 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13016 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 13017 | { } |
| 13018 | }; |
| 13019 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13020 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13021 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13022 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13023 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13024 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13025 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13026 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13027 | { } |
| 13028 | }; |
| 13029 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13030 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13031 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13032 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13033 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13035 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13036 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13037 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13038 | { } |
| 13039 | }; |
| 13040 | |
| 13041 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13042 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13043 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13044 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13045 | |
| 13046 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13047 | unsigned int res) |
| 13048 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13049 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13050 | return; |
| 13051 | alc268_acer_automute(codec, 1); |
| 13052 | } |
| 13053 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13054 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13055 | { |
| 13056 | alc268_acer_automute(codec, 1); |
| 13057 | } |
| 13058 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13059 | /* toggle speaker-output according to the hp-jack state */ |
| 13060 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13061 | { |
| 13062 | unsigned int present; |
| 13063 | unsigned char bits; |
| 13064 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13065 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13066 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13067 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13068 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13069 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13070 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13071 | } |
| 13072 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13073 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13074 | unsigned int res) |
| 13075 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13076 | switch (res >> 26) { |
| 13077 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13078 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13079 | break; |
| 13080 | case ALC880_MIC_EVENT: |
| 13081 | alc_mic_automute(codec); |
| 13082 | break; |
| 13083 | } |
| 13084 | } |
| 13085 | |
| 13086 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13087 | { |
| 13088 | struct alc_spec *spec = codec->spec; |
| 13089 | spec->ext_mic.pin = 0x18; |
| 13090 | spec->ext_mic.mux_idx = 0; |
| 13091 | spec->int_mic.pin = 0x12; |
| 13092 | spec->int_mic.mux_idx = 6; |
| 13093 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13094 | } |
| 13095 | |
| 13096 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13097 | { |
| 13098 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13099 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13100 | } |
| 13101 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13102 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13103 | /* output mixer control */ |
| 13104 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13105 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13106 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13107 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13108 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13109 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13110 | { } |
| 13111 | }; |
| 13112 | |
| 13113 | static struct hda_verb alc268_dell_verbs[] = { |
| 13114 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13115 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13116 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13117 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13118 | { } |
| 13119 | }; |
| 13120 | |
| 13121 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13122 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13123 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13124 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13125 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13126 | spec->autocfg.hp_pins[0] = 0x15; |
| 13127 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13128 | spec->ext_mic.pin = 0x18; |
| 13129 | spec->ext_mic.mux_idx = 0; |
| 13130 | spec->int_mic.pin = 0x19; |
| 13131 | spec->int_mic.mux_idx = 1; |
| 13132 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13133 | } |
| 13134 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13135 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13136 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13137 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13138 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13139 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13140 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13141 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13142 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13143 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13144 | { } |
| 13145 | }; |
| 13146 | |
| 13147 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13148 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13149 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13150 | { } |
| 13151 | }; |
| 13152 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13153 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13154 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13155 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13156 | spec->autocfg.hp_pins[0] = 0x15; |
| 13157 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13158 | spec->ext_mic.pin = 0x18; |
| 13159 | spec->ext_mic.mux_idx = 0; |
| 13160 | spec->int_mic.pin = 0x19; |
| 13161 | spec->int_mic.mux_idx = 1; |
| 13162 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13163 | } |
| 13164 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13165 | /* |
| 13166 | * generic initialization of ADC, input mixers and output mixers |
| 13167 | */ |
| 13168 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13169 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13170 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13171 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13172 | |
| 13173 | /* |
| 13174 | * Set up output mixers (0x0c - 0x0e) |
| 13175 | */ |
| 13176 | /* set vol=0 to output mixers */ |
| 13177 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13178 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13179 | |
| 13180 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13181 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13182 | |
| 13183 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13184 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13185 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13186 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13187 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13188 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13189 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13190 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13191 | |
| 13192 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13193 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13194 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13195 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13196 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13197 | |
| 13198 | /* set PCBEEP vol = 0, mute connections */ |
| 13199 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13200 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13201 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13202 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13203 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13204 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13205 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13206 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13207 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13208 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13209 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13210 | { } |
| 13211 | }; |
| 13212 | |
| 13213 | /* |
| 13214 | * generic initialization of ADC, input mixers and output mixers |
| 13215 | */ |
| 13216 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13217 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13218 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13219 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13220 | |
| 13221 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13222 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13223 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13224 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13225 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13226 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13227 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13228 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13229 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13230 | |
| 13231 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13232 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13233 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13234 | /* set PCBEEP vol = 0, mute connections */ |
| 13235 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13236 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13237 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13238 | |
| 13239 | { } |
| 13240 | }; |
| 13241 | |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13242 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13243 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13244 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13245 | { } /* end */ |
| 13246 | }; |
| 13247 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13248 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13249 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13250 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13251 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13252 | { } /* end */ |
| 13253 | }; |
| 13254 | |
| 13255 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13256 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13257 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13258 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13259 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13260 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13261 | { } /* end */ |
| 13262 | }; |
| 13263 | |
| 13264 | static struct hda_input_mux alc268_capture_source = { |
| 13265 | .num_items = 4, |
| 13266 | .items = { |
| 13267 | { "Mic", 0x0 }, |
| 13268 | { "Front Mic", 0x1 }, |
| 13269 | { "Line", 0x2 }, |
| 13270 | { "CD", 0x3 }, |
| 13271 | }, |
| 13272 | }; |
| 13273 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13274 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13275 | .num_items = 3, |
| 13276 | .items = { |
| 13277 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13278 | { "Internal Mic", 0x1 }, |
| 13279 | { "Line", 0x2 }, |
| 13280 | }, |
| 13281 | }; |
| 13282 | |
| 13283 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13284 | .num_items = 3, |
| 13285 | .items = { |
| 13286 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13287 | { "Internal Mic", 0x6 }, |
| 13288 | { "Line", 0x2 }, |
| 13289 | }, |
| 13290 | }; |
| 13291 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13292 | #ifdef CONFIG_SND_DEBUG |
| 13293 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13294 | /* Volume widgets */ |
| 13295 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13296 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13297 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13298 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13299 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13300 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13301 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13302 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13303 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13304 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13305 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13306 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13307 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13308 | /* The below appears problematic on some hardwares */ |
| 13309 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13310 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13311 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13312 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13313 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13314 | |
| 13315 | /* Modes for retasking pin widgets */ |
| 13316 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13317 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13318 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13319 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13320 | |
| 13321 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13322 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13323 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13324 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13325 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13326 | |
| 13327 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13328 | * The ALC268 does not have an SPDIF input. |
| 13329 | */ |
| 13330 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13331 | |
| 13332 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13333 | * this output to turn on an external amplifier. |
| 13334 | */ |
| 13335 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13336 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13337 | |
| 13338 | { } /* end */ |
| 13339 | }; |
| 13340 | #endif |
| 13341 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13342 | /* create input playback/capture controls for the given pin */ |
| 13343 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13344 | const char *ctlname, int idx) |
| 13345 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13346 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13347 | int err; |
| 13348 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13349 | switch (nid) { |
| 13350 | case 0x14: |
| 13351 | case 0x16: |
| 13352 | dac = 0x02; |
| 13353 | break; |
| 13354 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13355 | case 0x1a: /* ALC259/269 only */ |
| 13356 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13357 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13358 | dac = 0x03; |
| 13359 | break; |
| 13360 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13361 | snd_printd(KERN_WARNING "hda_codec: " |
| 13362 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13363 | return 0; |
| 13364 | } |
| 13365 | if (spec->multiout.dac_nids[0] != dac && |
| 13366 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13367 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13368 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13369 | HDA_OUTPUT)); |
| 13370 | if (err < 0) |
| 13371 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13372 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13373 | } |
| 13374 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13375 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13376 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13377 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13378 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13379 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13380 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13381 | if (err < 0) |
| 13382 | return err; |
| 13383 | return 0; |
| 13384 | } |
| 13385 | |
| 13386 | /* add playback controls from the parsed DAC table */ |
| 13387 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13388 | const struct auto_pin_cfg *cfg) |
| 13389 | { |
| 13390 | hda_nid_t nid; |
| 13391 | int err; |
| 13392 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13393 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13394 | |
| 13395 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13396 | if (nid) { |
| 13397 | const char *name; |
| 13398 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13399 | name = "Speaker"; |
| 13400 | else |
| 13401 | name = "Front"; |
| 13402 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13403 | if (err < 0) |
| 13404 | return err; |
| 13405 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13406 | |
| 13407 | nid = cfg->speaker_pins[0]; |
| 13408 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13409 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13410 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13411 | if (err < 0) |
| 13412 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13413 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13414 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13415 | if (err < 0) |
| 13416 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13417 | } |
| 13418 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13419 | if (nid) { |
| 13420 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13421 | if (err < 0) |
| 13422 | return err; |
| 13423 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13424 | |
| 13425 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13426 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13427 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13428 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13429 | if (err < 0) |
| 13430 | return err; |
| 13431 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13432 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13433 | } |
| 13434 | |
| 13435 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13436 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13437 | const struct auto_pin_cfg *cfg) |
| 13438 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13439 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13440 | } |
| 13441 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13442 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13443 | hda_nid_t nid, int pin_type) |
| 13444 | { |
| 13445 | int idx; |
| 13446 | |
| 13447 | alc_set_pin_output(codec, nid, pin_type); |
| 13448 | if (nid == 0x14 || nid == 0x16) |
| 13449 | idx = 0; |
| 13450 | else |
| 13451 | idx = 1; |
| 13452 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13453 | } |
| 13454 | |
| 13455 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13456 | { |
| 13457 | struct alc_spec *spec = codec->spec; |
| 13458 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13459 | if (nid) { |
| 13460 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13461 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13462 | } |
| 13463 | } |
| 13464 | |
| 13465 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13466 | { |
| 13467 | struct alc_spec *spec = codec->spec; |
| 13468 | hda_nid_t pin; |
| 13469 | |
| 13470 | pin = spec->autocfg.hp_pins[0]; |
| 13471 | if (pin) |
| 13472 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13473 | pin = spec->autocfg.speaker_pins[0]; |
| 13474 | if (pin) |
| 13475 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13476 | } |
| 13477 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13478 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13479 | { |
| 13480 | struct alc_spec *spec = codec->spec; |
| 13481 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13482 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13483 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13484 | unsigned int dac_vol1, dac_vol2; |
| 13485 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13486 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13487 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13488 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13489 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13490 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13491 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13492 | AMP_IN_UNMUTE(1)); |
| 13493 | snd_hda_codec_write(codec, 0x10, 0, |
| 13494 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13495 | AMP_IN_UNMUTE(1)); |
| 13496 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13497 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13498 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13499 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13500 | snd_hda_codec_write(codec, 0x10, 0, |
| 13501 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13502 | } |
| 13503 | |
| 13504 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13505 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13506 | dac_vol2 = AMP_OUT_ZERO; |
| 13507 | else if (line_nid == 0x15) |
| 13508 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13509 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13510 | dac_vol2 = AMP_OUT_ZERO; |
| 13511 | else if (hp_nid == 0x15) |
| 13512 | dac_vol1 = AMP_OUT_ZERO; |
| 13513 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13514 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13515 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13516 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13517 | |
| 13518 | snd_hda_codec_write(codec, 0x02, 0, |
| 13519 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13520 | snd_hda_codec_write(codec, 0x03, 0, |
| 13521 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13522 | } |
| 13523 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13524 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13525 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13526 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13527 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13528 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13529 | |
| 13530 | /* |
| 13531 | * BIOS auto configuration |
| 13532 | */ |
| 13533 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13534 | { |
| 13535 | struct alc_spec *spec = codec->spec; |
| 13536 | int err; |
| 13537 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13538 | |
| 13539 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13540 | alc268_ignore); |
| 13541 | if (err < 0) |
| 13542 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13543 | if (!spec->autocfg.line_outs) { |
| 13544 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13545 | spec->multiout.max_channels = 2; |
| 13546 | spec->no_analog = 1; |
| 13547 | goto dig_only; |
| 13548 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13549 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13550 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13551 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13552 | if (err < 0) |
| 13553 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13554 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13555 | if (err < 0) |
| 13556 | return err; |
| 13557 | |
| 13558 | spec->multiout.max_channels = 2; |
| 13559 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13560 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13561 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13562 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13563 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13564 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13565 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13566 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13567 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13568 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13569 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13570 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13571 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13572 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13573 | err = alc_auto_add_mic_boost(codec); |
| 13574 | if (err < 0) |
| 13575 | return err; |
| 13576 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13577 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13578 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13579 | return 1; |
| 13580 | } |
| 13581 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13582 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13583 | |
| 13584 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13585 | static void alc268_auto_init(struct hda_codec *codec) |
| 13586 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13587 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13588 | alc268_auto_init_multi_out(codec); |
| 13589 | alc268_auto_init_hp_out(codec); |
| 13590 | alc268_auto_init_mono_speaker_out(codec); |
| 13591 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13592 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13593 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13594 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13595 | } |
| 13596 | |
| 13597 | /* |
| 13598 | * configuration and preset |
| 13599 | */ |
| 13600 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13601 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13602 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13603 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13604 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13605 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13606 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13607 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13608 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13609 | #ifdef CONFIG_SND_DEBUG |
| 13610 | [ALC268_TEST] = "test", |
| 13611 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13612 | [ALC268_AUTO] = "auto", |
| 13613 | }; |
| 13614 | |
| 13615 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13616 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13617 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13618 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13619 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13620 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13621 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13622 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13623 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13624 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13625 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13626 | /* almost compatible with toshiba but with optional digital outs; |
| 13627 | * auto-probing seems working fine |
| 13628 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13629 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13630 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13631 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13632 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13633 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13634 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13635 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13636 | {} |
| 13637 | }; |
| 13638 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13639 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13640 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13641 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13642 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13643 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13644 | ALC268_TOSHIBA), |
| 13645 | {} |
| 13646 | }; |
| 13647 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13648 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13649 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13650 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13651 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13652 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13653 | alc267_quanta_il1_verbs }, |
| 13654 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13655 | .dac_nids = alc268_dac_nids, |
| 13656 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13657 | .adc_nids = alc268_adc_nids_alt, |
| 13658 | .hp_nid = 0x03, |
| 13659 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13660 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13661 | .unsol_event = alc_sku_unsol_event, |
| 13662 | .setup = alc267_quanta_il1_setup, |
| 13663 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13664 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13665 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13666 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13667 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13668 | .init_verbs = { alc268_base_init_verbs }, |
| 13669 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13670 | .dac_nids = alc268_dac_nids, |
| 13671 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13672 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13673 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13674 | .hp_nid = 0x03, |
| 13675 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13676 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13677 | .channel_mode = alc268_modes, |
| 13678 | .input_mux = &alc268_capture_source, |
| 13679 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13680 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13681 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13682 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13683 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13684 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13685 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13686 | .dac_nids = alc268_dac_nids, |
| 13687 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13688 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13689 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13690 | .hp_nid = 0x03, |
| 13691 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13692 | .channel_mode = alc268_modes, |
| 13693 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13694 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13695 | .setup = alc268_toshiba_setup, |
| 13696 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13697 | }, |
| 13698 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13699 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13700 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13701 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13702 | alc268_acer_verbs }, |
| 13703 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13704 | .dac_nids = alc268_dac_nids, |
| 13705 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13706 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13707 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13708 | .hp_nid = 0x02, |
| 13709 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13710 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13711 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13712 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13713 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13714 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13715 | [ALC268_ACER_DMIC] = { |
| 13716 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13717 | alc268_beep_mixer }, |
| 13718 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13719 | alc268_acer_verbs }, |
| 13720 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13721 | .dac_nids = alc268_dac_nids, |
| 13722 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13723 | .adc_nids = alc268_adc_nids_alt, |
| 13724 | .capsrc_nids = alc268_capsrc_nids, |
| 13725 | .hp_nid = 0x02, |
| 13726 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13727 | .channel_mode = alc268_modes, |
| 13728 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13729 | .unsol_event = alc268_acer_unsol_event, |
| 13730 | .init_hook = alc268_acer_init_hook, |
| 13731 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13732 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13733 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13734 | alc268_beep_mixer, |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13735 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13736 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13737 | alc268_acer_aspire_one_verbs }, |
| 13738 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13739 | .dac_nids = alc268_dac_nids, |
| 13740 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13741 | .adc_nids = alc268_adc_nids_alt, |
| 13742 | .capsrc_nids = alc268_capsrc_nids, |
| 13743 | .hp_nid = 0x03, |
| 13744 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13745 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13746 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13747 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13748 | .init_hook = alc268_acer_lc_init_hook, |
| 13749 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13750 | [ALC268_DELL] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13751 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13752 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13753 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13754 | alc268_dell_verbs }, |
| 13755 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13756 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13757 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13758 | .adc_nids = alc268_adc_nids_alt, |
| 13759 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13760 | .hp_nid = 0x02, |
| 13761 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13762 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13763 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13764 | .setup = alc268_dell_setup, |
| 13765 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13766 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13767 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13768 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13769 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13770 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13771 | alc268_toshiba_verbs }, |
| 13772 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13773 | .dac_nids = alc268_dac_nids, |
| 13774 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13775 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13776 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13777 | .hp_nid = 0x03, |
| 13778 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13779 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13780 | .channel_mode = alc268_modes, |
| 13781 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13782 | .setup = alc268_toshiba_setup, |
| 13783 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13784 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13785 | #ifdef CONFIG_SND_DEBUG |
| 13786 | [ALC268_TEST] = { |
| 13787 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13788 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13789 | alc268_volume_init_verbs }, |
| 13790 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13791 | .dac_nids = alc268_dac_nids, |
| 13792 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13793 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13794 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13795 | .hp_nid = 0x03, |
| 13796 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13797 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13798 | .channel_mode = alc268_modes, |
| 13799 | .input_mux = &alc268_capture_source, |
| 13800 | }, |
| 13801 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13802 | }; |
| 13803 | |
| 13804 | static int patch_alc268(struct hda_codec *codec) |
| 13805 | { |
| 13806 | struct alc_spec *spec; |
| 13807 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13808 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13809 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13810 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13811 | if (spec == NULL) |
| 13812 | return -ENOMEM; |
| 13813 | |
| 13814 | codec->spec = spec; |
| 13815 | |
| 13816 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13817 | alc268_models, |
| 13818 | alc268_cfg_tbl); |
| 13819 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13820 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13821 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13822 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13823 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13824 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13825 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13826 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13827 | board_config = ALC268_AUTO; |
| 13828 | } |
| 13829 | |
| 13830 | if (board_config == ALC268_AUTO) { |
| 13831 | /* automatic parse from the BIOS config */ |
| 13832 | err = alc268_parse_auto_config(codec); |
| 13833 | if (err < 0) { |
| 13834 | alc_free(codec); |
| 13835 | return err; |
| 13836 | } else if (!err) { |
| 13837 | printk(KERN_INFO |
| 13838 | "hda_codec: Cannot set up configuration " |
| 13839 | "from BIOS. Using base mode...\n"); |
| 13840 | board_config = ALC268_3ST; |
| 13841 | } |
| 13842 | } |
| 13843 | |
| 13844 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13845 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13846 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13847 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13848 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13849 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13850 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13851 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13852 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13853 | has_beep = 0; |
| 13854 | for (i = 0; i < spec->num_mixers; i++) { |
| 13855 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13856 | has_beep = 1; |
| 13857 | break; |
| 13858 | } |
| 13859 | } |
| 13860 | |
| 13861 | if (has_beep) { |
| 13862 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13863 | if (err < 0) { |
| 13864 | alc_free(codec); |
| 13865 | return err; |
| 13866 | } |
| 13867 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13868 | /* override the amp caps for beep generator */ |
| 13869 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13870 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13871 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13872 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13873 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13874 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13875 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13876 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13877 | /* check whether NID 0x07 is valid */ |
| 13878 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13879 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13880 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13881 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13882 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13883 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13884 | if (spec->auto_mic || |
| 13885 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13886 | spec->adc_nids = alc268_adc_nids_alt; |
| 13887 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13888 | if (spec->auto_mic) |
| 13889 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13890 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13891 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13892 | else |
| 13893 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13894 | } else { |
| 13895 | spec->adc_nids = alc268_adc_nids; |
| 13896 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13897 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13898 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13899 | /* set default input source */ |
| 13900 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13901 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13902 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13903 | i < spec->num_mux_defs ? |
| 13904 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13905 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13906 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13907 | |
| 13908 | spec->vmaster_nid = 0x02; |
| 13909 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13910 | codec->patch_ops = alc_patch_ops; |
| 13911 | if (board_config == ALC268_AUTO) |
| 13912 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13913 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13914 | return 0; |
| 13915 | } |
| 13916 | |
| 13917 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13918 | * ALC269 channel source setting (2 channel) |
| 13919 | */ |
| 13920 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13921 | |
| 13922 | #define alc269_dac_nids alc260_dac_nids |
| 13923 | |
| 13924 | static hda_nid_t alc269_adc_nids[1] = { |
| 13925 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13926 | 0x08, |
| 13927 | }; |
| 13928 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13929 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13930 | 0x23, |
| 13931 | }; |
| 13932 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13933 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13934 | /* ADC1 */ |
| 13935 | 0x09, |
| 13936 | }; |
| 13937 | |
| 13938 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13939 | 0x22, |
| 13940 | }; |
| 13941 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13942 | static hda_nid_t alc269_adc_candidates[] = { |
| 13943 | 0x08, 0x09, 0x07, |
| 13944 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13945 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13946 | #define alc269_modes alc260_modes |
| 13947 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13948 | |
| 13949 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13950 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13951 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13952 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13953 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13954 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13956 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13957 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13958 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13959 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13960 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13961 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13962 | { } /* end */ |
| 13963 | }; |
| 13964 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13965 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13966 | /* output mixer control */ |
| 13967 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13968 | { |
| 13969 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13970 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13971 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13972 | .info = snd_hda_mixer_amp_switch_info, |
| 13973 | .get = snd_hda_mixer_amp_switch_get, |
| 13974 | .put = alc268_acer_master_sw_put, |
| 13975 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13976 | }, |
| 13977 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13978 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13979 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13980 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13981 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13982 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13983 | { } |
| 13984 | }; |
| 13985 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13986 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13987 | /* output mixer control */ |
| 13988 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13989 | { |
| 13990 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13991 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13992 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13993 | .info = snd_hda_mixer_amp_switch_info, |
| 13994 | .get = snd_hda_mixer_amp_switch_get, |
| 13995 | .put = alc268_acer_master_sw_put, |
| 13996 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13997 | }, |
| 13998 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13999 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14000 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14001 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14002 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 14003 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 14004 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14005 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 14006 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14007 | { } |
| 14008 | }; |
| 14009 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14010 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14011 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14012 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14013 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14014 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14015 | { } /* end */ |
| 14016 | }; |
| 14017 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14018 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14019 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14020 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14021 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14022 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14023 | { } /* end */ |
| 14024 | }; |
| 14025 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14026 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14027 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14028 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14029 | { } /* end */ |
| 14030 | }; |
| 14031 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14032 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14033 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14034 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14035 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 14036 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14037 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 14038 | { } /* end */ |
| 14039 | }; |
| 14040 | |
| 14041 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14042 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14043 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14044 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14045 | { } /* end */ |
| 14046 | }; |
| 14047 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14048 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14049 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14050 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14051 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14052 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 14053 | { } /* end */ |
| 14054 | }; |
| 14055 | |
| 14056 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14057 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14058 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14059 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14060 | { } /* end */ |
| 14061 | }; |
| 14062 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14063 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14064 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14065 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14066 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14067 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14068 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14069 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14070 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14071 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14072 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14073 | { } |
| 14074 | }; |
| 14075 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14076 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14077 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14078 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14079 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14080 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14081 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14082 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14083 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14084 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14085 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14086 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14087 | { } |
| 14088 | }; |
| 14089 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14090 | /* toggle speaker-output according to the hp-jack state */ |
| 14091 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14092 | { |
| 14093 | unsigned int present; |
| 14094 | unsigned char bits; |
| 14095 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14096 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14097 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14098 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14099 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14100 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14101 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14102 | |
| 14103 | snd_hda_codec_write(codec, 0x20, 0, |
| 14104 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14105 | snd_hda_codec_write(codec, 0x20, 0, |
| 14106 | AC_VERB_SET_PROC_COEF, 0x680); |
| 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, 0x480); |
| 14112 | } |
| 14113 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14114 | /* toggle speaker-output according to the hp-jacks state */ |
| 14115 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14116 | { |
| 14117 | unsigned int present; |
| 14118 | unsigned char bits; |
| 14119 | |
| 14120 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14121 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14122 | |
| 14123 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14124 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14125 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14126 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14127 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14128 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14129 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14130 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14131 | |
| 14132 | snd_hda_codec_write(codec, 0x20, 0, |
| 14133 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14134 | snd_hda_codec_write(codec, 0x20, 0, |
| 14135 | AC_VERB_SET_PROC_COEF, 0x680); |
| 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, 0x480); |
| 14141 | } |
| 14142 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14143 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14144 | { |
| 14145 | unsigned int present_laptop; |
| 14146 | unsigned int present_dock; |
| 14147 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14148 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14149 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14150 | |
| 14151 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14152 | if (present_dock) |
| 14153 | snd_hda_codec_write(codec, 0x23, 0, |
| 14154 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14155 | if (present_laptop) |
| 14156 | snd_hda_codec_write(codec, 0x23, 0, |
| 14157 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14158 | if (!present_dock && !present_laptop) |
| 14159 | snd_hda_codec_write(codec, 0x23, 0, |
| 14160 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14161 | } |
| 14162 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14163 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14164 | unsigned int res) |
| 14165 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14166 | switch (res >> 26) { |
| 14167 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14168 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14169 | break; |
| 14170 | case ALC880_MIC_EVENT: |
| 14171 | alc_mic_automute(codec); |
| 14172 | break; |
| 14173 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14174 | } |
| 14175 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14176 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14177 | unsigned int res) |
| 14178 | { |
| 14179 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14180 | alc269_lifebook_speaker_automute(codec); |
| 14181 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14182 | alc269_lifebook_mic_autoswitch(codec); |
| 14183 | } |
| 14184 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14185 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14186 | { |
| 14187 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14188 | spec->autocfg.hp_pins[0] = 0x15; |
| 14189 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14190 | spec->ext_mic.pin = 0x18; |
| 14191 | spec->ext_mic.mux_idx = 0; |
| 14192 | spec->int_mic.pin = 0x19; |
| 14193 | spec->int_mic.mux_idx = 1; |
| 14194 | spec->auto_mic = 1; |
| 14195 | } |
| 14196 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14197 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14198 | { |
| 14199 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14200 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14201 | } |
| 14202 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14203 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14204 | { |
| 14205 | alc269_lifebook_speaker_automute(codec); |
| 14206 | alc269_lifebook_mic_autoswitch(codec); |
| 14207 | } |
| 14208 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14209 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14210 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14211 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14212 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14213 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14214 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14215 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14216 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14217 | {} |
| 14218 | }; |
| 14219 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14220 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14221 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14222 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14223 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14224 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14225 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14226 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14227 | {} |
| 14228 | }; |
| 14229 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14230 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14231 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14232 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14233 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14234 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14235 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14236 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14237 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14238 | {} |
| 14239 | }; |
| 14240 | |
| 14241 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14242 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14243 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14244 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14245 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14246 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14247 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14248 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14249 | {} |
| 14250 | }; |
| 14251 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14252 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14253 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14254 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14255 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14257 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14258 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14259 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14260 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14261 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14262 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14263 | { } |
| 14264 | }; |
| 14265 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14266 | /* toggle speaker-output according to the hp-jack state */ |
| 14267 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14268 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14269 | struct alc_spec *spec = codec->spec; |
| 14270 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14271 | unsigned int present; |
| 14272 | unsigned char bits; |
| 14273 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14274 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14275 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14276 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14277 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14278 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14279 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14280 | } |
| 14281 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14282 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14283 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14284 | unsigned int res) |
| 14285 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14286 | switch (res >> 26) { |
| 14287 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14288 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14289 | break; |
| 14290 | case ALC880_MIC_EVENT: |
| 14291 | alc_mic_automute(codec); |
| 14292 | break; |
| 14293 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14294 | } |
| 14295 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14296 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14297 | { |
| 14298 | struct alc_spec *spec = codec->spec; |
| 14299 | spec->autocfg.hp_pins[0] = 0x15; |
| 14300 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14301 | spec->ext_mic.pin = 0x18; |
| 14302 | spec->ext_mic.mux_idx = 0; |
| 14303 | spec->int_mic.pin = 0x19; |
| 14304 | spec->int_mic.mux_idx = 1; |
| 14305 | spec->auto_mic = 1; |
| 14306 | } |
| 14307 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14308 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14309 | { |
| 14310 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14311 | spec->autocfg.hp_pins[0] = 0x15; |
| 14312 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14313 | spec->ext_mic.pin = 0x18; |
| 14314 | spec->ext_mic.mux_idx = 0; |
| 14315 | spec->int_mic.pin = 0x12; |
| 14316 | spec->int_mic.mux_idx = 5; |
| 14317 | spec->auto_mic = 1; |
| 14318 | } |
| 14319 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14320 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14321 | { |
| 14322 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14323 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14324 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14325 | spec->ext_mic.pin = 0x18; |
| 14326 | spec->ext_mic.mux_idx = 0; |
| 14327 | spec->int_mic.pin = 0x19; |
| 14328 | spec->int_mic.mux_idx = 1; |
| 14329 | spec->auto_mic = 1; |
| 14330 | } |
| 14331 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14332 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14333 | { |
| 14334 | struct alc_spec *spec = codec->spec; |
| 14335 | spec->autocfg.hp_pins[0] = 0x21; |
| 14336 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14337 | spec->ext_mic.pin = 0x18; |
| 14338 | spec->ext_mic.mux_idx = 0; |
| 14339 | spec->int_mic.pin = 0x12; |
| 14340 | spec->int_mic.mux_idx = 6; |
| 14341 | spec->auto_mic = 1; |
| 14342 | } |
| 14343 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14344 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14345 | { |
| 14346 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14347 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14348 | } |
| 14349 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14350 | /* |
| 14351 | * generic initialization of ADC, input mixers and output mixers |
| 14352 | */ |
| 14353 | static struct hda_verb alc269_init_verbs[] = { |
| 14354 | /* |
| 14355 | * Unmute ADC0 and set the default input to mic-in |
| 14356 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14357 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14358 | |
| 14359 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14360 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14361 | */ |
| 14362 | /* set vol=0 to output mixers */ |
| 14363 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14364 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14365 | |
| 14366 | /* set up input amps for analog loopback */ |
| 14367 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14368 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14369 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14370 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14371 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14372 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14373 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14374 | |
| 14375 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14376 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14377 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14378 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14379 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14381 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14382 | |
| 14383 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14384 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14385 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14386 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14387 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14388 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14389 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14390 | |
| 14391 | /* set EAPD */ |
| 14392 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14393 | { } |
| 14394 | }; |
| 14395 | |
| 14396 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14397 | /* |
| 14398 | * Unmute ADC0 and set the default input to mic-in |
| 14399 | */ |
| 14400 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14401 | |
| 14402 | /* |
| 14403 | * Set up output mixers (0x02 - 0x03) |
| 14404 | */ |
| 14405 | /* set vol=0 to output mixers */ |
| 14406 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14407 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14408 | |
| 14409 | /* set up input amps for analog loopback */ |
| 14410 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14411 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14412 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14413 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14414 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14415 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14416 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14417 | |
| 14418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14419 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14420 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14421 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14422 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14423 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14424 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14425 | |
| 14426 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14427 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14428 | |
| 14429 | /* FIXME: use Mux-type input source selection */ |
| 14430 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14431 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14432 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14433 | |
| 14434 | /* set EAPD */ |
| 14435 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14436 | { } |
| 14437 | }; |
| 14438 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14439 | #define alc269_auto_create_multi_out_ctls \ |
| 14440 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14441 | #define alc269_auto_create_input_ctls \ |
| 14442 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14443 | |
| 14444 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14445 | #define alc269_loopbacks alc880_loopbacks |
| 14446 | #endif |
| 14447 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14448 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14449 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14450 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14451 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14452 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14453 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14454 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14455 | .substreams = 1, |
| 14456 | .channels_min = 2, |
| 14457 | .channels_max = 8, |
| 14458 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14459 | /* NID is set in alc_build_pcms */ |
| 14460 | .ops = { |
| 14461 | .open = alc880_playback_pcm_open, |
| 14462 | .prepare = alc880_playback_pcm_prepare, |
| 14463 | .cleanup = alc880_playback_pcm_cleanup |
| 14464 | }, |
| 14465 | }; |
| 14466 | |
| 14467 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14468 | .substreams = 1, |
| 14469 | .channels_min = 2, |
| 14470 | .channels_max = 2, |
| 14471 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14472 | /* NID is set in alc_build_pcms */ |
| 14473 | }; |
| 14474 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14475 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14476 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14477 | { |
| 14478 | switch (codec->subsystem_id) { |
| 14479 | case 0x103c1586: |
| 14480 | return 1; |
| 14481 | } |
| 14482 | return 0; |
| 14483 | } |
| 14484 | |
| 14485 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14486 | { |
| 14487 | /* update mute-LED according to the speaker mute state */ |
| 14488 | if (nid == 0x01 || nid == 0x14) { |
| 14489 | int pinval; |
| 14490 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14491 | HDA_AMP_MUTE) |
| 14492 | pinval = 0x24; |
| 14493 | else |
| 14494 | pinval = 0x20; |
| 14495 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a5 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14496 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14497 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14498 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14499 | } |
| 14500 | return alc_check_power_status(codec, nid); |
| 14501 | } |
| 14502 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14503 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14504 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14505 | { |
| 14506 | struct alc_spec *spec = codec->spec; |
| 14507 | |
| 14508 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14509 | return 0; |
| 14510 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14511 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14512 | if (spec->ext_mic.pin <= 0x12) { |
| 14513 | spec->private_adc_nids[0] = 0x08; |
| 14514 | spec->private_adc_nids[1] = 0x11; |
| 14515 | spec->private_capsrc_nids[0] = 0x23; |
| 14516 | spec->private_capsrc_nids[1] = 0x22; |
| 14517 | } else { |
| 14518 | spec->private_adc_nids[0] = 0x11; |
| 14519 | spec->private_adc_nids[1] = 0x08; |
| 14520 | spec->private_capsrc_nids[0] = 0x22; |
| 14521 | spec->private_capsrc_nids[1] = 0x23; |
| 14522 | } |
| 14523 | spec->adc_nids = spec->private_adc_nids; |
| 14524 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14525 | spec->num_adc_nids = 2; |
| 14526 | spec->dual_adc_switch = 1; |
| 14527 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14528 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14529 | return 1; |
| 14530 | } |
| 14531 | return 0; |
| 14532 | } |
| 14533 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14534 | /* |
| 14535 | * BIOS auto configuration |
| 14536 | */ |
| 14537 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14538 | { |
| 14539 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14540 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14541 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14542 | |
| 14543 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14544 | alc269_ignore); |
| 14545 | if (err < 0) |
| 14546 | return err; |
| 14547 | |
| 14548 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14549 | if (err < 0) |
| 14550 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14551 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14552 | if (err < 0) |
| 14553 | return err; |
| 14554 | |
| 14555 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14556 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14557 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14558 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14559 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14560 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14561 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14562 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14563 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14564 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14565 | } else { |
| 14566 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14567 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14568 | } |
| 14569 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14570 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14571 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14572 | |
| 14573 | if (!alc275_setup_dual_adc(codec)) |
| 14574 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14575 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14576 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14577 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14578 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14579 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14580 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14581 | |
| 14582 | err = alc_auto_add_mic_boost(codec); |
| 14583 | if (err < 0) |
| 14584 | return err; |
| 14585 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14586 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14587 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14588 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14589 | return 1; |
| 14590 | } |
| 14591 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14592 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14593 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14594 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14595 | |
| 14596 | |
| 14597 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14598 | static void alc269_auto_init(struct hda_codec *codec) |
| 14599 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14600 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14601 | alc269_auto_init_multi_out(codec); |
| 14602 | alc269_auto_init_hp_out(codec); |
| 14603 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14604 | alc_auto_init_digital(codec); |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 14605 | alc_init_jacks(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14606 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14607 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14608 | } |
| 14609 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame^] | 14610 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14611 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14612 | { |
| 14613 | struct alc_spec *spec = codec->spec; |
| 14614 | int val; |
| 14615 | |
| 14616 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 14617 | val = alc_read_coef_idx(codec, 0x04); |
| 14618 | /* Power down output pin */ |
| 14619 | alc_write_coef_idx(codec, 0x04, val & ~(1<<11)); |
| 14620 | } |
| 14621 | |
| 14622 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14623 | val = alc_read_coef_idx(codec, 0x04); |
| 14624 | /* Power down output pin */ |
| 14625 | alc_write_coef_idx(codec, 0x04, val & ~(1<<11)); |
| 14626 | msleep(150); |
| 14627 | } |
| 14628 | |
| 14629 | alc_shutup(codec); |
| 14630 | if (spec && spec->power_hook) |
| 14631 | spec->power_hook(codec); |
| 14632 | return 0; |
| 14633 | } |
| 14634 | #endif |
| 14635 | #ifdef SND_HDA_NEEDS_RESUME |
| 14636 | static int alc269_resume(struct hda_codec *codec) |
| 14637 | { |
| 14638 | int val; |
| 14639 | |
| 14640 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14641 | val = alc_read_coef_idx(codec, 0x04); |
| 14642 | /* Power down output pin */ |
| 14643 | alc_write_coef_idx(codec, 0x04, val & ~(1<<11)); |
| 14644 | msleep(150); |
| 14645 | } |
| 14646 | |
| 14647 | codec->patch_ops.init(codec); |
| 14648 | |
| 14649 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 14650 | val = alc_read_coef_idx(codec, 0x04); |
| 14651 | /* Power up output pin */ |
| 14652 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 14653 | msleep(200); |
| 14654 | } |
| 14655 | |
| 14656 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14657 | val = alc_read_coef_idx(codec, 0x04); |
| 14658 | /* Power up output pin */ |
| 14659 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 14660 | } |
| 14661 | |
| 14662 | snd_hda_codec_resume_amp(codec); |
| 14663 | snd_hda_codec_resume_cache(codec); |
| 14664 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14665 | if (codec->patch_ops.check_power_status) |
| 14666 | codec->patch_ops.check_power_status(codec, 0x01); |
| 14667 | #endif |
| 14668 | return 0; |
| 14669 | } |
| 14670 | #endif |
| 14671 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14672 | enum { |
| 14673 | ALC269_FIXUP_SONY_VAIO, |
| 14674 | }; |
| 14675 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14676 | static const struct alc_fixup alc269_fixups[] = { |
| 14677 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14678 | .verbs = (const struct hda_verb[]) { |
| 14679 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14680 | {} |
| 14681 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14682 | }, |
| 14683 | }; |
| 14684 | |
| 14685 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14686 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | dbbcbc0 | 2010-08-23 08:14:35 +0200 | [diff] [blame] | 14687 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14688 | {} |
| 14689 | }; |
| 14690 | |
| 14691 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14692 | /* |
| 14693 | * configuration and preset |
| 14694 | */ |
| 14695 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14696 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14697 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14698 | [ALC269_AMIC] = "laptop-amic", |
| 14699 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14700 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14701 | [ALC269_LIFEBOOK] = "lifebook", |
| 14702 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14703 | }; |
| 14704 | |
| 14705 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14706 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14707 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14708 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14709 | ALC269_AMIC), |
| 14710 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14711 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14712 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14713 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14714 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14715 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14716 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14717 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14718 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14719 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14720 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14721 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14722 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14723 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14724 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14725 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14726 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14727 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14728 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14729 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14730 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14731 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14732 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14733 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14734 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14735 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14736 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14737 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14738 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14739 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14740 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14741 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14742 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14743 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14744 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14745 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14746 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14747 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14748 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14749 | ALC269_DMIC), |
| 14750 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14751 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14752 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14753 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14754 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14755 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14756 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14757 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14758 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14759 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14760 | {} |
| 14761 | }; |
| 14762 | |
| 14763 | static struct alc_config_preset alc269_presets[] = { |
| 14764 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14765 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14766 | .init_verbs = { alc269_init_verbs }, |
| 14767 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14768 | .dac_nids = alc269_dac_nids, |
| 14769 | .hp_nid = 0x03, |
| 14770 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14771 | .channel_mode = alc269_modes, |
| 14772 | .input_mux = &alc269_capture_source, |
| 14773 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14774 | [ALC269_QUANTA_FL1] = { |
| 14775 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14776 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14777 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14778 | .dac_nids = alc269_dac_nids, |
| 14779 | .hp_nid = 0x03, |
| 14780 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14781 | .channel_mode = alc269_modes, |
| 14782 | .input_mux = &alc269_capture_source, |
| 14783 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14784 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14785 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14786 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14787 | [ALC269_AMIC] = { |
| 14788 | .mixers = { alc269_laptop_mixer }, |
| 14789 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14790 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14791 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14792 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14793 | .dac_nids = alc269_dac_nids, |
| 14794 | .hp_nid = 0x03, |
| 14795 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14796 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14797 | .unsol_event = alc269_laptop_unsol_event, |
| 14798 | .setup = alc269_laptop_amic_setup, |
| 14799 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14800 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14801 | [ALC269_DMIC] = { |
| 14802 | .mixers = { alc269_laptop_mixer }, |
| 14803 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14804 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14805 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14806 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14807 | .dac_nids = alc269_dac_nids, |
| 14808 | .hp_nid = 0x03, |
| 14809 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14810 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14811 | .unsol_event = alc269_laptop_unsol_event, |
| 14812 | .setup = alc269_laptop_dmic_setup, |
| 14813 | .init_hook = alc269_laptop_inithook, |
| 14814 | }, |
| 14815 | [ALC269VB_AMIC] = { |
| 14816 | .mixers = { alc269vb_laptop_mixer }, |
| 14817 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14818 | .init_verbs = { alc269vb_init_verbs, |
| 14819 | alc269vb_laptop_amic_init_verbs }, |
| 14820 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14821 | .dac_nids = alc269_dac_nids, |
| 14822 | .hp_nid = 0x03, |
| 14823 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14824 | .channel_mode = alc269_modes, |
| 14825 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14826 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14827 | .init_hook = alc269_laptop_inithook, |
| 14828 | }, |
| 14829 | [ALC269VB_DMIC] = { |
| 14830 | .mixers = { alc269vb_laptop_mixer }, |
| 14831 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14832 | .init_verbs = { alc269vb_init_verbs, |
| 14833 | alc269vb_laptop_dmic_init_verbs }, |
| 14834 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14835 | .dac_nids = alc269_dac_nids, |
| 14836 | .hp_nid = 0x03, |
| 14837 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14838 | .channel_mode = alc269_modes, |
| 14839 | .unsol_event = alc269_laptop_unsol_event, |
| 14840 | .setup = alc269vb_laptop_dmic_setup, |
| 14841 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14842 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14843 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14844 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14845 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14846 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14847 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14848 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14849 | .dac_nids = alc269_dac_nids, |
| 14850 | .hp_nid = 0x03, |
| 14851 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14852 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14853 | .unsol_event = alc269_laptop_unsol_event, |
| 14854 | .setup = alc269_laptop_dmic_setup, |
| 14855 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14856 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14857 | [ALC269_LIFEBOOK] = { |
| 14858 | .mixers = { alc269_lifebook_mixer }, |
| 14859 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14860 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14861 | .dac_nids = alc269_dac_nids, |
| 14862 | .hp_nid = 0x03, |
| 14863 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14864 | .channel_mode = alc269_modes, |
| 14865 | .input_mux = &alc269_capture_source, |
| 14866 | .unsol_event = alc269_lifebook_unsol_event, |
| 14867 | .init_hook = alc269_lifebook_init_hook, |
| 14868 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14869 | [ALC271_ACER] = { |
| 14870 | .mixers = { alc269_asus_mixer }, |
| 14871 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14872 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14873 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14874 | .dac_nids = alc269_dac_nids, |
| 14875 | .adc_nids = alc262_dmic_adc_nids, |
| 14876 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14877 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14878 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14879 | .channel_mode = alc269_modes, |
| 14880 | .input_mux = &alc269_capture_source, |
| 14881 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14882 | .unsol_event = alc_sku_unsol_event, |
| 14883 | .setup = alc269vb_laptop_dmic_setup, |
| 14884 | .init_hook = alc_inithook, |
| 14885 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14886 | }; |
| 14887 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame^] | 14888 | static int alc269_fill_coef(struct hda_codec *codec) |
| 14889 | { |
| 14890 | int val; |
| 14891 | |
| 14892 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 14893 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14894 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 14895 | } |
| 14896 | |
| 14897 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 14898 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14899 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 14900 | } |
| 14901 | |
| 14902 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 14903 | val = alc_read_coef_idx(codec, 0x04); |
| 14904 | /* Power up output pin */ |
| 14905 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 14906 | } |
| 14907 | |
| 14908 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14909 | val = alc_read_coef_idx(codec, 0xd); |
| 14910 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 14911 | /* Capless ramp up clock control */ |
| 14912 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 14913 | } |
| 14914 | val = alc_read_coef_idx(codec, 0x17); |
| 14915 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 14916 | /* Class D power on reset */ |
| 14917 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 14918 | } |
| 14919 | } |
| 14920 | return 0; |
| 14921 | } |
| 14922 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14923 | static int patch_alc269(struct hda_codec *codec) |
| 14924 | { |
| 14925 | struct alc_spec *spec; |
| 14926 | int board_config; |
| 14927 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14928 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14929 | |
| 14930 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14931 | if (spec == NULL) |
| 14932 | return -ENOMEM; |
| 14933 | |
| 14934 | codec->spec = spec; |
| 14935 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14936 | alc_auto_parse_customize_define(codec); |
| 14937 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14938 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14939 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14940 | spec->cdefine.platform_type == 1) |
| 14941 | alc_codec_rename(codec, "ALC271X"); |
| 14942 | else |
| 14943 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14944 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14945 | } else |
| 14946 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14947 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame^] | 14948 | alc269_fill_coef(codec); |
| 14949 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14950 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14951 | alc269_models, |
| 14952 | alc269_cfg_tbl); |
| 14953 | |
| 14954 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14955 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14956 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14957 | board_config = ALC269_AUTO; |
| 14958 | } |
| 14959 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14960 | if (board_config == ALC269_AUTO) |
| 14961 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14962 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14963 | if (board_config == ALC269_AUTO) { |
| 14964 | /* automatic parse from the BIOS config */ |
| 14965 | err = alc269_parse_auto_config(codec); |
| 14966 | if (err < 0) { |
| 14967 | alc_free(codec); |
| 14968 | return err; |
| 14969 | } else if (!err) { |
| 14970 | printk(KERN_INFO |
| 14971 | "hda_codec: Cannot set up configuration " |
| 14972 | "from BIOS. Using base mode...\n"); |
| 14973 | board_config = ALC269_BASIC; |
| 14974 | } |
| 14975 | } |
| 14976 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14977 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 14978 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14979 | if (err < 0) { |
| 14980 | alc_free(codec); |
| 14981 | return err; |
| 14982 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14983 | } |
| 14984 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14985 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14986 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14987 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14988 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14989 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14990 | * fix the sample rate of analog I/O to 44.1kHz |
| 14991 | */ |
| 14992 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14993 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14994 | } else if (spec->dual_adc_switch) { |
| 14995 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14996 | /* switch ADC dynamically */ |
| 14997 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14998 | } else { |
| 14999 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15000 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15001 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15002 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15003 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15004 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15005 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 15006 | if (!is_alc269vb) { |
| 15007 | spec->adc_nids = alc269_adc_nids; |
| 15008 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15009 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15010 | } else { |
| 15011 | spec->adc_nids = alc269vb_adc_nids; |
| 15012 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15013 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15014 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15015 | } |
| 15016 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15017 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15018 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15019 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15020 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15021 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15022 | if (board_config == ALC269_AUTO) |
| 15023 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 15024 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15025 | spec->vmaster_nid = 0x02; |
| 15026 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15027 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame^] | 15028 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15029 | codec->patch_ops.suspend = alc269_suspend; |
| 15030 | #endif |
| 15031 | #ifdef SND_HDA_NEEDS_RESUME |
| 15032 | codec->patch_ops.resume = alc269_resume; |
| 15033 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15034 | if (board_config == ALC269_AUTO) |
| 15035 | spec->init_hook = alc269_auto_init; |
| 15036 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15037 | if (!spec->loopback.amplist) |
| 15038 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15039 | if (alc269_mic2_for_mute_led(codec)) |
| 15040 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15041 | #endif |
| 15042 | |
| 15043 | return 0; |
| 15044 | } |
| 15045 | |
| 15046 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15047 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15048 | */ |
| 15049 | |
| 15050 | /* |
| 15051 | * set the path ways for 2 channel output |
| 15052 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15053 | */ |
| 15054 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15055 | /* set pin widget 1Ah (line in) for input */ |
| 15056 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15057 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15058 | * the vref |
| 15059 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15060 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15061 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15062 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15063 | #if 0 |
| 15064 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15065 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15066 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15067 | { } /* end */ |
| 15068 | }; |
| 15069 | /* |
| 15070 | * 6ch mode |
| 15071 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15072 | */ |
| 15073 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15074 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15075 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15076 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15077 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15078 | |
| 15079 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15080 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15081 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15082 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15083 | #if 0 |
| 15084 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15085 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15086 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15087 | { } /* end */ |
| 15088 | }; |
| 15089 | |
| 15090 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15091 | { 2, alc861_threestack_ch2_init }, |
| 15092 | { 6, alc861_threestack_ch6_init }, |
| 15093 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15094 | /* Set mic1 as input and unmute the mixer */ |
| 15095 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15096 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15097 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15098 | { } /* end */ |
| 15099 | }; |
| 15100 | /* Set mic1 as output and mute mixer */ |
| 15101 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15102 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15103 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15104 | { } /* end */ |
| 15105 | }; |
| 15106 | |
| 15107 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15108 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15109 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15110 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15111 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15112 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15113 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15114 | /* set pin widget 1Ah (line in) for input */ |
| 15115 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15116 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15117 | * the vref |
| 15118 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15119 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15120 | |
| 15121 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15122 | #if 0 |
| 15123 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15124 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15125 | #endif |
| 15126 | { } /* end */ |
| 15127 | }; |
| 15128 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15129 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15130 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15131 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15132 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15133 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15134 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15135 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15136 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15137 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15138 | |
| 15139 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15140 | #if 0 |
| 15141 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15142 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15143 | #endif |
| 15144 | { } /* end */ |
| 15145 | }; |
| 15146 | |
| 15147 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15148 | { 2, alc861_asus_ch2_init }, |
| 15149 | { 6, alc861_asus_ch6_init }, |
| 15150 | }; |
| 15151 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15152 | /* patch-ALC861 */ |
| 15153 | |
| 15154 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15155 | /* output mixer control */ |
| 15156 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15157 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15158 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15159 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15160 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15161 | |
| 15162 | /*Input mixer control */ |
| 15163 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15164 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15165 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15166 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15167 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15168 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15171 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15172 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15173 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15174 | { } /* end */ |
| 15175 | }; |
| 15176 | |
| 15177 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15178 | /* output mixer control */ |
| 15179 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15180 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15181 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15182 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15183 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15184 | |
| 15185 | /* Input mixer control */ |
| 15186 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15187 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15188 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15189 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15190 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15191 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15194 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15195 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15196 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15197 | { |
| 15198 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15199 | .name = "Channel Mode", |
| 15200 | .info = alc_ch_mode_info, |
| 15201 | .get = alc_ch_mode_get, |
| 15202 | .put = alc_ch_mode_put, |
| 15203 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15204 | }, |
| 15205 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15206 | }; |
| 15207 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15208 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15209 | /* output mixer control */ |
| 15210 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15211 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15213 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15214 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15215 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15216 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15217 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15218 | /* output mixer control */ |
| 15219 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15220 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15221 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15222 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15223 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15224 | |
| 15225 | /* Input mixer control */ |
| 15226 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15227 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15228 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15229 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15230 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15231 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15232 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15233 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15234 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15235 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15236 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15237 | { |
| 15238 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15239 | .name = "Channel Mode", |
| 15240 | .info = alc_ch_mode_info, |
| 15241 | .get = alc_ch_mode_get, |
| 15242 | .put = alc_ch_mode_put, |
| 15243 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15244 | }, |
| 15245 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15246 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15247 | |
| 15248 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15249 | /* output mixer control */ |
| 15250 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15251 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15252 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15253 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15254 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15255 | |
| 15256 | /* Input mixer control */ |
| 15257 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15258 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15259 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15260 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15261 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15262 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15265 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15267 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15268 | { |
| 15269 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15270 | .name = "Channel Mode", |
| 15271 | .info = alc_ch_mode_info, |
| 15272 | .get = alc_ch_mode_get, |
| 15273 | .put = alc_ch_mode_put, |
| 15274 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15275 | }, |
| 15276 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15277 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15278 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15279 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15280 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15281 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15282 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15283 | { } |
| 15284 | }; |
| 15285 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15286 | /* |
| 15287 | * generic initialization of ADC, input mixers and output mixers |
| 15288 | */ |
| 15289 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15290 | /* |
| 15291 | * Unmute ADC0 and set the default input to mic-in |
| 15292 | */ |
| 15293 | /* port-A for surround (rear panel) */ |
| 15294 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15295 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15296 | /* port-B for mic-in (rear panel) with vref */ |
| 15297 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15298 | /* port-C for line-in (rear panel) */ |
| 15299 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15300 | /* port-D for Front */ |
| 15301 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15302 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15303 | /* port-E for HP out (front panel) */ |
| 15304 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15305 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15306 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15307 | /* port-F for mic-in (front panel) with vref */ |
| 15308 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15309 | /* port-G for CLFE (rear panel) */ |
| 15310 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15311 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15312 | /* port-H for side (rear panel) */ |
| 15313 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15314 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15315 | /* CD-in */ |
| 15316 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15317 | /* route front mic to ADC1*/ |
| 15318 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15319 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15320 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15321 | /* Unmute DAC0~3 & spdif out*/ |
| 15322 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15323 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15324 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15325 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15326 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15327 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15328 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15329 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15330 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15331 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15332 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15333 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15334 | /* Unmute Stereo Mixer 15 */ |
| 15335 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15336 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15337 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15338 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15339 | |
| 15340 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15341 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15342 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15343 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15344 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15345 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15346 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15347 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15348 | /* hp used DAC 3 (Front) */ |
| 15349 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15350 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15351 | |
| 15352 | { } |
| 15353 | }; |
| 15354 | |
| 15355 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15356 | /* |
| 15357 | * Unmute ADC0 and set the default input to mic-in |
| 15358 | */ |
| 15359 | /* port-A for surround (rear panel) */ |
| 15360 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15361 | /* port-B for mic-in (rear panel) with vref */ |
| 15362 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15363 | /* port-C for line-in (rear panel) */ |
| 15364 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15365 | /* port-D for Front */ |
| 15366 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15367 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15368 | /* port-E for HP out (front panel) */ |
| 15369 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15370 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15371 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15372 | /* port-F for mic-in (front panel) with vref */ |
| 15373 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15374 | /* port-G for CLFE (rear panel) */ |
| 15375 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15376 | /* port-H for side (rear panel) */ |
| 15377 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15378 | /* CD-in */ |
| 15379 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15380 | /* route front mic to ADC1*/ |
| 15381 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15382 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15383 | /* Unmute DAC0~3 & spdif out*/ |
| 15384 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15385 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15386 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15387 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15388 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15389 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15390 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15391 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15392 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15393 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15394 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15396 | /* Unmute Stereo Mixer 15 */ |
| 15397 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15398 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15399 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15400 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15401 | |
| 15402 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15403 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15404 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15405 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15406 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15407 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15408 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15409 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15410 | /* hp used DAC 3 (Front) */ |
| 15411 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15412 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15413 | { } |
| 15414 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15415 | |
| 15416 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15417 | /* |
| 15418 | * Unmute ADC0 and set the default input to mic-in |
| 15419 | */ |
| 15420 | /* port-A for surround (rear panel) */ |
| 15421 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15422 | /* port-B for mic-in (rear panel) with vref */ |
| 15423 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15424 | /* port-C for line-in (rear panel) */ |
| 15425 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15426 | /* port-D for Front */ |
| 15427 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15428 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15429 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15430 | /* this has to be set to VREF80 */ |
| 15431 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15432 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15433 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15434 | /* port-F for mic-in (front panel) with vref */ |
| 15435 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15436 | /* port-G for CLFE (rear panel) */ |
| 15437 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15438 | /* port-H for side (rear panel) */ |
| 15439 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15440 | /* CD-in */ |
| 15441 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15442 | /* route front mic to ADC1*/ |
| 15443 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15444 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15445 | /* Unmute DAC0~3 & spdif out*/ |
| 15446 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15447 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15448 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15449 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15450 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15451 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15452 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15453 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15454 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15455 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15456 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15457 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15458 | /* Unmute Stereo Mixer 15 */ |
| 15459 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15460 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15461 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15462 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15463 | |
| 15464 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15465 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15466 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15467 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15468 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15469 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15470 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15471 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15472 | /* hp used DAC 3 (Front) */ |
| 15473 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15474 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15475 | { } |
| 15476 | }; |
| 15477 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15478 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15479 | /* |
| 15480 | * Unmute ADC0 and set the default input to mic-in |
| 15481 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15482 | /* port-A for surround (rear panel) |
| 15483 | * according to codec#0 this is the HP jack |
| 15484 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15485 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15486 | /* route front PCM to HP */ |
| 15487 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15488 | /* port-B for mic-in (rear panel) with vref */ |
| 15489 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15490 | /* port-C for line-in (rear panel) */ |
| 15491 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15492 | /* port-D for Front */ |
| 15493 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15494 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15495 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15496 | /* this has to be set to VREF80 */ |
| 15497 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15498 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15499 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15500 | /* port-F for mic-in (front panel) with vref */ |
| 15501 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15502 | /* port-G for CLFE (rear panel) */ |
| 15503 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15504 | /* port-H for side (rear panel) */ |
| 15505 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15506 | /* CD-in */ |
| 15507 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15508 | /* route front mic to ADC1*/ |
| 15509 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15510 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15511 | /* Unmute DAC0~3 & spdif out*/ |
| 15512 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15513 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15514 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15515 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15516 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15517 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15518 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15519 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15520 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15521 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15522 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15523 | /* Unmute Stereo Mixer 15 */ |
| 15524 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15525 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15526 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15527 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15528 | |
| 15529 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15530 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15531 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15532 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15533 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15534 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15535 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15536 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15537 | /* hp used DAC 3 (Front) */ |
| 15538 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15539 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15540 | { } |
| 15541 | }; |
| 15542 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15543 | /* additional init verbs for ASUS laptops */ |
| 15544 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15545 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15546 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15547 | { } |
| 15548 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15549 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15550 | /* |
| 15551 | * generic initialization of ADC, input mixers and output mixers |
| 15552 | */ |
| 15553 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15554 | /* |
| 15555 | * Unmute ADC0 and set the default input to mic-in |
| 15556 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15557 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15558 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15560 | /* Unmute DAC0~3 & spdif out*/ |
| 15561 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15562 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15563 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15564 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15566 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15567 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15568 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15569 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15570 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15571 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15572 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15573 | /* Unmute Stereo Mixer 15 */ |
| 15574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15575 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15576 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15577 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15578 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15579 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15580 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15581 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15582 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15583 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15584 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15585 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15586 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15587 | |
| 15588 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15589 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15590 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15591 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15592 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15593 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15594 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15595 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15596 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15597 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15598 | |
| 15599 | { } |
| 15600 | }; |
| 15601 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15602 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15603 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15604 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15605 | { } |
| 15606 | }; |
| 15607 | |
| 15608 | /* toggle speaker-output according to the hp-jack state */ |
| 15609 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15610 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15611 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15612 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15613 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15614 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15615 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15616 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15617 | } |
| 15618 | |
| 15619 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15620 | unsigned int res) |
| 15621 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15622 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15623 | alc861_toshiba_automute(codec); |
| 15624 | } |
| 15625 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15626 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15627 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15628 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15629 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15630 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15631 | |
| 15632 | |
| 15633 | #define ALC861_DIGOUT_NID 0x07 |
| 15634 | |
| 15635 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15636 | { 8, NULL } |
| 15637 | }; |
| 15638 | |
| 15639 | static hda_nid_t alc861_dac_nids[4] = { |
| 15640 | /* front, surround, clfe, side */ |
| 15641 | 0x03, 0x06, 0x05, 0x04 |
| 15642 | }; |
| 15643 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15644 | static hda_nid_t alc660_dac_nids[3] = { |
| 15645 | /* front, clfe, surround */ |
| 15646 | 0x03, 0x05, 0x06 |
| 15647 | }; |
| 15648 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15649 | static hda_nid_t alc861_adc_nids[1] = { |
| 15650 | /* ADC0-2 */ |
| 15651 | 0x08, |
| 15652 | }; |
| 15653 | |
| 15654 | static struct hda_input_mux alc861_capture_source = { |
| 15655 | .num_items = 5, |
| 15656 | .items = { |
| 15657 | { "Mic", 0x0 }, |
| 15658 | { "Front Mic", 0x3 }, |
| 15659 | { "Line", 0x1 }, |
| 15660 | { "CD", 0x4 }, |
| 15661 | { "Mixer", 0x5 }, |
| 15662 | }, |
| 15663 | }; |
| 15664 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15665 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15666 | { |
| 15667 | struct alc_spec *spec = codec->spec; |
| 15668 | hda_nid_t mix, srcs[5]; |
| 15669 | int i, j, num; |
| 15670 | |
| 15671 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15672 | return 0; |
| 15673 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15674 | if (num < 0) |
| 15675 | return 0; |
| 15676 | for (i = 0; i < num; i++) { |
| 15677 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15678 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15679 | if (type != AC_WID_AUD_OUT) |
| 15680 | continue; |
| 15681 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15682 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15683 | break; |
| 15684 | if (j >= spec->multiout.num_dacs) |
| 15685 | return srcs[i]; |
| 15686 | } |
| 15687 | return 0; |
| 15688 | } |
| 15689 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15690 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15691 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15692 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15693 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15694 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15695 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15696 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15697 | |
| 15698 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15699 | for (i = 0; i < cfg->line_outs; i++) { |
| 15700 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15701 | dac = alc861_look_for_dac(codec, nid); |
| 15702 | if (!dac) |
| 15703 | continue; |
| 15704 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15705 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15706 | return 0; |
| 15707 | } |
| 15708 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15709 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15710 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15711 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15712 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15713 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15714 | } |
| 15715 | |
| 15716 | /* add playback controls from the parsed DAC table */ |
| 15717 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15718 | const struct auto_pin_cfg *cfg) |
| 15719 | { |
| 15720 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15721 | static const char *chname[4] = { |
| 15722 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15723 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15724 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15725 | int i, err; |
| 15726 | |
| 15727 | if (cfg->line_outs == 1) { |
| 15728 | const char *pfx = NULL; |
| 15729 | if (!cfg->hp_outs) |
| 15730 | pfx = "Master"; |
| 15731 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15732 | pfx = "Speaker"; |
| 15733 | if (pfx) { |
| 15734 | nid = spec->multiout.dac_nids[0]; |
| 15735 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15736 | } |
| 15737 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15738 | |
| 15739 | for (i = 0; i < cfg->line_outs; i++) { |
| 15740 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15741 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15742 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15743 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15744 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15745 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15746 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15747 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15748 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15749 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15750 | return err; |
| 15751 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15752 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15753 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15754 | return err; |
| 15755 | } |
| 15756 | } |
| 15757 | return 0; |
| 15758 | } |
| 15759 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15760 | 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] | 15761 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15762 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15763 | int err; |
| 15764 | hda_nid_t nid; |
| 15765 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15766 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15767 | return 0; |
| 15768 | |
| 15769 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15770 | nid = alc861_look_for_dac(codec, pin); |
| 15771 | if (nid) { |
| 15772 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15773 | if (err < 0) |
| 15774 | return err; |
| 15775 | spec->multiout.hp_nid = nid; |
| 15776 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15777 | } |
| 15778 | return 0; |
| 15779 | } |
| 15780 | |
| 15781 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15782 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15783 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15784 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15785 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15786 | } |
| 15787 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15788 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15789 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15790 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15791 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15792 | hda_nid_t mix, srcs[5]; |
| 15793 | int i, num; |
| 15794 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15795 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15796 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15797 | 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] | 15798 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15799 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15800 | return; |
| 15801 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15802 | if (num < 0) |
| 15803 | return; |
| 15804 | for (i = 0; i < num; i++) { |
| 15805 | unsigned int mute; |
| 15806 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15807 | mute = AMP_IN_UNMUTE(i); |
| 15808 | else |
| 15809 | mute = AMP_IN_MUTE(i); |
| 15810 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15811 | mute); |
| 15812 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15813 | } |
| 15814 | |
| 15815 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15816 | { |
| 15817 | struct alc_spec *spec = codec->spec; |
| 15818 | int i; |
| 15819 | |
| 15820 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15821 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15822 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15823 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15824 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15825 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15826 | } |
| 15827 | } |
| 15828 | |
| 15829 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15830 | { |
| 15831 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15832 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15833 | if (spec->autocfg.hp_outs) |
| 15834 | alc861_auto_set_output_and_unmute(codec, |
| 15835 | spec->autocfg.hp_pins[0], |
| 15836 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15837 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15838 | if (spec->autocfg.speaker_outs) |
| 15839 | alc861_auto_set_output_and_unmute(codec, |
| 15840 | spec->autocfg.speaker_pins[0], |
| 15841 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15842 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15843 | } |
| 15844 | |
| 15845 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15846 | { |
| 15847 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15848 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15849 | int i; |
| 15850 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15851 | for (i = 0; i < cfg->num_inputs; i++) { |
| 15852 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15853 | if (nid >= 0x0c && nid <= 0x11) |
| 15854 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15855 | } |
| 15856 | } |
| 15857 | |
| 15858 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15859 | /* return 1 if successful, 0 if the proper config is not found, |
| 15860 | * or a negative error code |
| 15861 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15862 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15863 | { |
| 15864 | struct alc_spec *spec = codec->spec; |
| 15865 | int err; |
| 15866 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15867 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15868 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15869 | alc861_ignore); |
| 15870 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15871 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15872 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15873 | return 0; /* can't find valid BIOS pin config */ |
| 15874 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15875 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15876 | if (err < 0) |
| 15877 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15878 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15879 | if (err < 0) |
| 15880 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15881 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15882 | if (err < 0) |
| 15883 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15884 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15885 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15886 | return err; |
| 15887 | |
| 15888 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15889 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15890 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15891 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15892 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15893 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15894 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15895 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15896 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15897 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15898 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15899 | |
| 15900 | spec->adc_nids = alc861_adc_nids; |
| 15901 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15902 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15903 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15904 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15905 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15906 | return 1; |
| 15907 | } |
| 15908 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15909 | /* additional initialization for auto-configuration model */ |
| 15910 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15911 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15912 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15913 | alc861_auto_init_multi_out(codec); |
| 15914 | alc861_auto_init_hp_out(codec); |
| 15915 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15916 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15917 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15918 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15919 | } |
| 15920 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15921 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15922 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15923 | { 0x15, HDA_INPUT, 0 }, |
| 15924 | { 0x15, HDA_INPUT, 1 }, |
| 15925 | { 0x15, HDA_INPUT, 2 }, |
| 15926 | { 0x15, HDA_INPUT, 3 }, |
| 15927 | { } /* end */ |
| 15928 | }; |
| 15929 | #endif |
| 15930 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15931 | |
| 15932 | /* |
| 15933 | * configuration and preset |
| 15934 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15935 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15936 | [ALC861_3ST] = "3stack", |
| 15937 | [ALC660_3ST] = "3stack-660", |
| 15938 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15939 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15940 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15941 | [ALC861_TOSHIBA] = "toshiba", |
| 15942 | [ALC861_ASUS] = "asus", |
| 15943 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15944 | [ALC861_AUTO] = "auto", |
| 15945 | }; |
| 15946 | |
| 15947 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15948 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15949 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15950 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15951 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15952 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15953 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15954 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15955 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15956 | * Any other models that need this preset? |
| 15957 | */ |
| 15958 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15959 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15960 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15961 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15962 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15963 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15964 | /* FIXME: the below seems conflict */ |
| 15965 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15966 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15967 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15968 | {} |
| 15969 | }; |
| 15970 | |
| 15971 | static struct alc_config_preset alc861_presets[] = { |
| 15972 | [ALC861_3ST] = { |
| 15973 | .mixers = { alc861_3ST_mixer }, |
| 15974 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15975 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15976 | .dac_nids = alc861_dac_nids, |
| 15977 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15978 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15979 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15980 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15981 | .adc_nids = alc861_adc_nids, |
| 15982 | .input_mux = &alc861_capture_source, |
| 15983 | }, |
| 15984 | [ALC861_3ST_DIG] = { |
| 15985 | .mixers = { alc861_base_mixer }, |
| 15986 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15987 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15988 | .dac_nids = alc861_dac_nids, |
| 15989 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15990 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15991 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15992 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15993 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15994 | .adc_nids = alc861_adc_nids, |
| 15995 | .input_mux = &alc861_capture_source, |
| 15996 | }, |
| 15997 | [ALC861_6ST_DIG] = { |
| 15998 | .mixers = { alc861_base_mixer }, |
| 15999 | .init_verbs = { alc861_base_init_verbs }, |
| 16000 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16001 | .dac_nids = alc861_dac_nids, |
| 16002 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16003 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16004 | .channel_mode = alc861_8ch_modes, |
| 16005 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16006 | .adc_nids = alc861_adc_nids, |
| 16007 | .input_mux = &alc861_capture_source, |
| 16008 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16009 | [ALC660_3ST] = { |
| 16010 | .mixers = { alc861_3ST_mixer }, |
| 16011 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16012 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16013 | .dac_nids = alc660_dac_nids, |
| 16014 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16015 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16016 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16017 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16018 | .adc_nids = alc861_adc_nids, |
| 16019 | .input_mux = &alc861_capture_source, |
| 16020 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16021 | [ALC861_UNIWILL_M31] = { |
| 16022 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16023 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16024 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16025 | .dac_nids = alc861_dac_nids, |
| 16026 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16027 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16028 | .channel_mode = alc861_uniwill_m31_modes, |
| 16029 | .need_dac_fix = 1, |
| 16030 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16031 | .adc_nids = alc861_adc_nids, |
| 16032 | .input_mux = &alc861_capture_source, |
| 16033 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16034 | [ALC861_TOSHIBA] = { |
| 16035 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16036 | .init_verbs = { alc861_base_init_verbs, |
| 16037 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16038 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16039 | .dac_nids = alc861_dac_nids, |
| 16040 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16041 | .channel_mode = alc883_3ST_2ch_modes, |
| 16042 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16043 | .adc_nids = alc861_adc_nids, |
| 16044 | .input_mux = &alc861_capture_source, |
| 16045 | .unsol_event = alc861_toshiba_unsol_event, |
| 16046 | .init_hook = alc861_toshiba_automute, |
| 16047 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16048 | [ALC861_ASUS] = { |
| 16049 | .mixers = { alc861_asus_mixer }, |
| 16050 | .init_verbs = { alc861_asus_init_verbs }, |
| 16051 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16052 | .dac_nids = alc861_dac_nids, |
| 16053 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16054 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16055 | .channel_mode = alc861_asus_modes, |
| 16056 | .need_dac_fix = 1, |
| 16057 | .hp_nid = 0x06, |
| 16058 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16059 | .adc_nids = alc861_adc_nids, |
| 16060 | .input_mux = &alc861_capture_source, |
| 16061 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16062 | [ALC861_ASUS_LAPTOP] = { |
| 16063 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16064 | .init_verbs = { alc861_asus_init_verbs, |
| 16065 | alc861_asus_laptop_init_verbs }, |
| 16066 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16067 | .dac_nids = alc861_dac_nids, |
| 16068 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16069 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16070 | .channel_mode = alc883_3ST_2ch_modes, |
| 16071 | .need_dac_fix = 1, |
| 16072 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16073 | .adc_nids = alc861_adc_nids, |
| 16074 | .input_mux = &alc861_capture_source, |
| 16075 | }, |
| 16076 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16077 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16078 | /* Pin config fixes */ |
| 16079 | enum { |
| 16080 | PINFIX_FSC_AMILO_PI1505, |
| 16081 | }; |
| 16082 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16083 | static const struct alc_fixup alc861_fixups[] = { |
| 16084 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16085 | .pins = (const struct alc_pincfg[]) { |
| 16086 | { 0x0b, 0x0221101f }, /* HP */ |
| 16087 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16088 | { } |
| 16089 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16090 | }, |
| 16091 | }; |
| 16092 | |
| 16093 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16094 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16095 | {} |
| 16096 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16097 | |
| 16098 | static int patch_alc861(struct hda_codec *codec) |
| 16099 | { |
| 16100 | struct alc_spec *spec; |
| 16101 | int board_config; |
| 16102 | int err; |
| 16103 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16104 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16105 | if (spec == NULL) |
| 16106 | return -ENOMEM; |
| 16107 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16108 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16109 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16110 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16111 | alc861_models, |
| 16112 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16113 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16114 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16115 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16116 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16117 | board_config = ALC861_AUTO; |
| 16118 | } |
| 16119 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16120 | if (board_config == ALC861_AUTO) |
| 16121 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16122 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16123 | if (board_config == ALC861_AUTO) { |
| 16124 | /* automatic parse from the BIOS config */ |
| 16125 | err = alc861_parse_auto_config(codec); |
| 16126 | if (err < 0) { |
| 16127 | alc_free(codec); |
| 16128 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16129 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16130 | printk(KERN_INFO |
| 16131 | "hda_codec: Cannot set up configuration " |
| 16132 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16133 | board_config = ALC861_3ST_DIG; |
| 16134 | } |
| 16135 | } |
| 16136 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16137 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16138 | if (err < 0) { |
| 16139 | alc_free(codec); |
| 16140 | return err; |
| 16141 | } |
| 16142 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16143 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16144 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16146 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16147 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16148 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16149 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16150 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16151 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16152 | if (!spec->cap_mixer) |
| 16153 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16154 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16155 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16156 | spec->vmaster_nid = 0x03; |
| 16157 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16158 | if (board_config == ALC861_AUTO) |
| 16159 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 16160 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16161 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16162 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16163 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16164 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16165 | spec->power_hook = alc_power_eapd; |
| 16166 | #endif |
| 16167 | } |
| 16168 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16169 | if (!spec->loopback.amplist) |
| 16170 | spec->loopback.amplist = alc861_loopbacks; |
| 16171 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16173 | return 0; |
| 16174 | } |
| 16175 | |
| 16176 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16177 | * ALC861-VD support |
| 16178 | * |
| 16179 | * Based on ALC882 |
| 16180 | * |
| 16181 | * In addition, an independent DAC |
| 16182 | */ |
| 16183 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16184 | |
| 16185 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16186 | /* front, surr, clfe, side surr */ |
| 16187 | 0x02, 0x03, 0x04, 0x05 |
| 16188 | }; |
| 16189 | |
| 16190 | /* dac_nids for ALC660vd are in a different order - according to |
| 16191 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16192 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16193 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16194 | * - and it is the same as in 861vd. |
| 16195 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16196 | */ |
| 16197 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16198 | /* front, rear, clfe, rear_surr */ |
| 16199 | 0x02, 0x04, 0x03 |
| 16200 | }; |
| 16201 | |
| 16202 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16203 | /* ADC0 */ |
| 16204 | 0x09, |
| 16205 | }; |
| 16206 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16207 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16208 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16209 | /* input MUX */ |
| 16210 | /* FIXME: should be a matrix-type input source selection */ |
| 16211 | static struct hda_input_mux alc861vd_capture_source = { |
| 16212 | .num_items = 4, |
| 16213 | .items = { |
| 16214 | { "Mic", 0x0 }, |
| 16215 | { "Front Mic", 0x1 }, |
| 16216 | { "Line", 0x2 }, |
| 16217 | { "CD", 0x4 }, |
| 16218 | }, |
| 16219 | }; |
| 16220 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16221 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16222 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16223 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16224 | { "Ext Mic", 0x0 }, |
| 16225 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16226 | }, |
| 16227 | }; |
| 16228 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16229 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16230 | .num_items = 2, |
| 16231 | .items = { |
| 16232 | { "Front Mic", 0x0 }, |
| 16233 | { "ATAPI Mic", 0x1 }, |
| 16234 | }, |
| 16235 | }; |
| 16236 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16237 | /* |
| 16238 | * 2ch mode |
| 16239 | */ |
| 16240 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16241 | { 2, NULL } |
| 16242 | }; |
| 16243 | |
| 16244 | /* |
| 16245 | * 6ch mode |
| 16246 | */ |
| 16247 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16248 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16249 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16250 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16251 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16252 | { } /* end */ |
| 16253 | }; |
| 16254 | |
| 16255 | /* |
| 16256 | * 8ch mode |
| 16257 | */ |
| 16258 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16259 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16260 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16261 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16262 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16263 | { } /* end */ |
| 16264 | }; |
| 16265 | |
| 16266 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16267 | { 6, alc861vd_6stack_ch6_init }, |
| 16268 | { 8, alc861vd_6stack_ch8_init }, |
| 16269 | }; |
| 16270 | |
| 16271 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16272 | { |
| 16273 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16274 | .name = "Channel Mode", |
| 16275 | .info = alc_ch_mode_info, |
| 16276 | .get = alc_ch_mode_get, |
| 16277 | .put = alc_ch_mode_put, |
| 16278 | }, |
| 16279 | { } /* end */ |
| 16280 | }; |
| 16281 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16282 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16283 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16284 | */ |
| 16285 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16286 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16287 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16288 | |
| 16289 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16290 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16291 | |
| 16292 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16293 | HDA_OUTPUT), |
| 16294 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16295 | HDA_OUTPUT), |
| 16296 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16297 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16298 | |
| 16299 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16300 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16301 | |
| 16302 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16303 | |
| 16304 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16305 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16306 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16307 | |
| 16308 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16309 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16310 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16311 | |
| 16312 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16313 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16314 | |
| 16315 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16316 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16317 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16318 | { } /* end */ |
| 16319 | }; |
| 16320 | |
| 16321 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16322 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16323 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16324 | |
| 16325 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16326 | |
| 16327 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16328 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16330 | |
| 16331 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16332 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16333 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16334 | |
| 16335 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16336 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16337 | |
| 16338 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16339 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16340 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16341 | { } /* end */ |
| 16342 | }; |
| 16343 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16344 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16345 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16346 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16347 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16348 | |
| 16349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16350 | |
| 16351 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16352 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16354 | |
| 16355 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16356 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16357 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16358 | |
| 16359 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16360 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16361 | |
| 16362 | { } /* end */ |
| 16363 | }; |
| 16364 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16365 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 16366 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16367 | */ |
| 16368 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16369 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16370 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16371 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16372 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16373 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16374 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16375 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16376 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16377 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16378 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16379 | { } /* end */ |
| 16380 | }; |
| 16381 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16382 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16383 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16384 | */ |
| 16385 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16386 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16387 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16388 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16389 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16390 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16391 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16392 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16393 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16394 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16395 | { } /* end */ |
| 16396 | }; |
| 16397 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16398 | /* |
| 16399 | * generic initialization of ADC, input mixers and output mixers |
| 16400 | */ |
| 16401 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16402 | /* |
| 16403 | * Unmute ADC0 and set the default input to mic-in |
| 16404 | */ |
| 16405 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16406 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16407 | |
| 16408 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16409 | * the analog-loopback mixer widget |
| 16410 | */ |
| 16411 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16412 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16413 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16414 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16415 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16416 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16417 | |
| 16418 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16419 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16420 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16421 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16422 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16423 | |
| 16424 | /* |
| 16425 | * Set up output mixers (0x02 - 0x05) |
| 16426 | */ |
| 16427 | /* set vol=0 to output mixers */ |
| 16428 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16429 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16430 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16431 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16432 | |
| 16433 | /* set up input amps for analog loopback */ |
| 16434 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16435 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16436 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16437 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16438 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16439 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16441 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16442 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16443 | |
| 16444 | { } |
| 16445 | }; |
| 16446 | |
| 16447 | /* |
| 16448 | * 3-stack pin configuration: |
| 16449 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16450 | */ |
| 16451 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16452 | /* |
| 16453 | * Set pin mode and muting |
| 16454 | */ |
| 16455 | /* set front pin widgets 0x14 for output */ |
| 16456 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16457 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16458 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16459 | |
| 16460 | /* Mic (rear) pin: input vref at 80% */ |
| 16461 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16462 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16463 | /* Front Mic pin: input vref at 80% */ |
| 16464 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16465 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16466 | /* Line In pin: input */ |
| 16467 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16468 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16469 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16470 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16471 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16472 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16473 | /* CD pin widget for input */ |
| 16474 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16475 | |
| 16476 | { } |
| 16477 | }; |
| 16478 | |
| 16479 | /* |
| 16480 | * 6-stack pin configuration: |
| 16481 | */ |
| 16482 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16483 | /* |
| 16484 | * Set pin mode and muting |
| 16485 | */ |
| 16486 | /* set front pin widgets 0x14 for output */ |
| 16487 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16488 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16489 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16490 | |
| 16491 | /* Rear Pin: output 1 (0x0d) */ |
| 16492 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16493 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16494 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16495 | /* CLFE Pin: output 2 (0x0e) */ |
| 16496 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16497 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16498 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16499 | /* Side Pin: output 3 (0x0f) */ |
| 16500 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16501 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16502 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16503 | |
| 16504 | /* Mic (rear) pin: input vref at 80% */ |
| 16505 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16506 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16507 | /* Front Mic pin: input vref at 80% */ |
| 16508 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16509 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16510 | /* Line In pin: input */ |
| 16511 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16512 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16513 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16514 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16515 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16516 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16517 | /* CD pin widget for input */ |
| 16518 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16519 | |
| 16520 | { } |
| 16521 | }; |
| 16522 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16523 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16524 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16525 | { } |
| 16526 | }; |
| 16527 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16528 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16529 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16530 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16531 | { } |
| 16532 | }; |
| 16533 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16534 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16537 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16538 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16539 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16540 | {} |
| 16541 | }; |
| 16542 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16543 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16544 | { |
| 16545 | unsigned int present; |
| 16546 | unsigned char bits; |
| 16547 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16548 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16549 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16550 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16551 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16552 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16553 | } |
| 16554 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16555 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16556 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16557 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16558 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16559 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16560 | } |
| 16561 | |
| 16562 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16563 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16564 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16565 | alc861vd_lenovo_mic_automute(codec); |
| 16566 | } |
| 16567 | |
| 16568 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16569 | unsigned int res) |
| 16570 | { |
| 16571 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16572 | case ALC880_MIC_EVENT: |
| 16573 | alc861vd_lenovo_mic_automute(codec); |
| 16574 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16575 | default: |
| 16576 | alc_automute_amp_unsol_event(codec, res); |
| 16577 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16578 | } |
| 16579 | } |
| 16580 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16581 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16582 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16583 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16584 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16585 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16586 | |
| 16587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16590 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16591 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16592 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16593 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16595 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16596 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16597 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16598 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16599 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16600 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16601 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16602 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16603 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16604 | |
| 16605 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16606 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16607 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16608 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16609 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16610 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16611 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16612 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16613 | |
| 16614 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16615 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16616 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16618 | |
| 16619 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16620 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16621 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16622 | |
| 16623 | { } /* end */ |
| 16624 | }; |
| 16625 | |
| 16626 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16627 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16628 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16629 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16630 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16631 | spec->autocfg.hp_pins[0] = 0x15; |
| 16632 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16633 | } |
| 16634 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16635 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16636 | #define alc861vd_loopbacks alc880_loopbacks |
| 16637 | #endif |
| 16638 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16639 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16640 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16641 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16642 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16643 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16644 | |
| 16645 | /* |
| 16646 | * configuration and preset |
| 16647 | */ |
| 16648 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16649 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16650 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16651 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16652 | [ALC861VD_3ST] = "3stack", |
| 16653 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16654 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16655 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16656 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16657 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16658 | [ALC861VD_AUTO] = "auto", |
| 16659 | }; |
| 16660 | |
| 16661 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16662 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16663 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16664 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16665 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16666 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16667 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16668 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16669 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16670 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16671 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16672 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16673 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16674 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16675 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16676 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16677 | {} |
| 16678 | }; |
| 16679 | |
| 16680 | static struct alc_config_preset alc861vd_presets[] = { |
| 16681 | [ALC660VD_3ST] = { |
| 16682 | .mixers = { alc861vd_3st_mixer }, |
| 16683 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16684 | alc861vd_3stack_init_verbs }, |
| 16685 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16686 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16687 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16688 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16689 | .input_mux = &alc861vd_capture_source, |
| 16690 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16691 | [ALC660VD_3ST_DIG] = { |
| 16692 | .mixers = { alc861vd_3st_mixer }, |
| 16693 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16694 | alc861vd_3stack_init_verbs }, |
| 16695 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16696 | .dac_nids = alc660vd_dac_nids, |
| 16697 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16698 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16699 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16700 | .input_mux = &alc861vd_capture_source, |
| 16701 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16702 | [ALC861VD_3ST] = { |
| 16703 | .mixers = { alc861vd_3st_mixer }, |
| 16704 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16705 | alc861vd_3stack_init_verbs }, |
| 16706 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16707 | .dac_nids = alc861vd_dac_nids, |
| 16708 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16709 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16710 | .input_mux = &alc861vd_capture_source, |
| 16711 | }, |
| 16712 | [ALC861VD_3ST_DIG] = { |
| 16713 | .mixers = { alc861vd_3st_mixer }, |
| 16714 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16715 | alc861vd_3stack_init_verbs }, |
| 16716 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16717 | .dac_nids = alc861vd_dac_nids, |
| 16718 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16719 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16720 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16721 | .input_mux = &alc861vd_capture_source, |
| 16722 | }, |
| 16723 | [ALC861VD_6ST_DIG] = { |
| 16724 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16725 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16726 | alc861vd_6stack_init_verbs }, |
| 16727 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16728 | .dac_nids = alc861vd_dac_nids, |
| 16729 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16730 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16731 | .channel_mode = alc861vd_6stack_modes, |
| 16732 | .input_mux = &alc861vd_capture_source, |
| 16733 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16734 | [ALC861VD_LENOVO] = { |
| 16735 | .mixers = { alc861vd_lenovo_mixer }, |
| 16736 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16737 | alc861vd_3stack_init_verbs, |
| 16738 | alc861vd_eapd_verbs, |
| 16739 | alc861vd_lenovo_unsol_verbs }, |
| 16740 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16741 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16742 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16743 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16744 | .input_mux = &alc861vd_capture_source, |
| 16745 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16746 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16747 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16748 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16749 | [ALC861VD_DALLAS] = { |
| 16750 | .mixers = { alc861vd_dallas_mixer }, |
| 16751 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16752 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16753 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16754 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16755 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16756 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16757 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16758 | .setup = alc861vd_dallas_setup, |
| 16759 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16760 | }, |
| 16761 | [ALC861VD_HP] = { |
| 16762 | .mixers = { alc861vd_hp_mixer }, |
| 16763 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16764 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16765 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16766 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16767 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16768 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16769 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16770 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16771 | .setup = alc861vd_dallas_setup, |
| 16772 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16773 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16774 | [ALC660VD_ASUS_V1S] = { |
| 16775 | .mixers = { alc861vd_lenovo_mixer }, |
| 16776 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16777 | alc861vd_3stack_init_verbs, |
| 16778 | alc861vd_eapd_verbs, |
| 16779 | alc861vd_lenovo_unsol_verbs }, |
| 16780 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16781 | .dac_nids = alc660vd_dac_nids, |
| 16782 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16783 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16784 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16785 | .input_mux = &alc861vd_capture_source, |
| 16786 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16787 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16788 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16789 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16790 | }; |
| 16791 | |
| 16792 | /* |
| 16793 | * BIOS auto configuration |
| 16794 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16795 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16796 | const struct auto_pin_cfg *cfg) |
| 16797 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16798 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16799 | } |
| 16800 | |
| 16801 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16802 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16803 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16804 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16805 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16806 | } |
| 16807 | |
| 16808 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16809 | { |
| 16810 | struct alc_spec *spec = codec->spec; |
| 16811 | int i; |
| 16812 | |
| 16813 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16814 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16815 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16816 | if (nid) |
| 16817 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16818 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16819 | } |
| 16820 | } |
| 16821 | |
| 16822 | |
| 16823 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16824 | { |
| 16825 | struct alc_spec *spec = codec->spec; |
| 16826 | hda_nid_t pin; |
| 16827 | |
| 16828 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16829 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16830 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16831 | pin = spec->autocfg.speaker_pins[0]; |
| 16832 | if (pin) |
| 16833 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16834 | } |
| 16835 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16836 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16837 | |
| 16838 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16839 | { |
| 16840 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16841 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16842 | int i; |
| 16843 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16844 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16845 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16846 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16847 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16848 | if (nid != ALC861VD_PIN_CD_NID && |
| 16849 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16850 | snd_hda_codec_write(codec, nid, 0, |
| 16851 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16852 | AMP_OUT_MUTE); |
| 16853 | } |
| 16854 | } |
| 16855 | } |
| 16856 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16857 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16858 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16859 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16860 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16861 | |
| 16862 | /* add playback controls from the parsed DAC table */ |
| 16863 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16864 | * different NIDs for mute/unmute switch and volume control */ |
| 16865 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16866 | const struct auto_pin_cfg *cfg) |
| 16867 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16868 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16869 | hda_nid_t nid_v, nid_s; |
| 16870 | int i, err; |
| 16871 | |
| 16872 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16873 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16874 | continue; |
| 16875 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16876 | alc880_dac_to_idx( |
| 16877 | spec->multiout.dac_nids[i])); |
| 16878 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16879 | alc880_dac_to_idx( |
| 16880 | spec->multiout.dac_nids[i])); |
| 16881 | |
| 16882 | if (i == 2) { |
| 16883 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16884 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16885 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16886 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16887 | HDA_OUTPUT)); |
| 16888 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16889 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16890 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16891 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16892 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16893 | HDA_OUTPUT)); |
| 16894 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16895 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16896 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16897 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16898 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16899 | HDA_INPUT)); |
| 16900 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16901 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16902 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16903 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16904 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16905 | HDA_INPUT)); |
| 16906 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16907 | return err; |
| 16908 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16909 | const char *pfx; |
| 16910 | if (cfg->line_outs == 1 && |
| 16911 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16912 | if (!cfg->hp_pins) |
| 16913 | pfx = "Speaker"; |
| 16914 | else |
| 16915 | pfx = "PCM"; |
| 16916 | } else |
| 16917 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16918 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16919 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16920 | HDA_OUTPUT)); |
| 16921 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16922 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16923 | if (cfg->line_outs == 1 && |
| 16924 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16925 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16926 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16927 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16928 | HDA_INPUT)); |
| 16929 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16930 | return err; |
| 16931 | } |
| 16932 | } |
| 16933 | return 0; |
| 16934 | } |
| 16935 | |
| 16936 | /* add playback controls for speaker and HP outputs */ |
| 16937 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16938 | * different NIDs for mute/unmute switch and volume control */ |
| 16939 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16940 | hda_nid_t pin, const char *pfx) |
| 16941 | { |
| 16942 | hda_nid_t nid_v, nid_s; |
| 16943 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16944 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16945 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16946 | return 0; |
| 16947 | |
| 16948 | if (alc880_is_fixed_pin(pin)) { |
| 16949 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16950 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16951 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16952 | spec->multiout.hp_nid = nid_v; |
| 16953 | else |
| 16954 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16955 | /* control HP volume/switch on the output mixer amp */ |
| 16956 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16957 | alc880_fixed_pin_idx(pin)); |
| 16958 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16959 | alc880_fixed_pin_idx(pin)); |
| 16960 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16961 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16962 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16963 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16964 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16965 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16966 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16967 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16968 | return err; |
| 16969 | } else if (alc880_is_multi_pin(pin)) { |
| 16970 | /* set manual connection */ |
| 16971 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16972 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16973 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16974 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16975 | return err; |
| 16976 | } |
| 16977 | return 0; |
| 16978 | } |
| 16979 | |
| 16980 | /* parse the BIOS configuration and set up the alc_spec |
| 16981 | * return 1 if successful, 0 if the proper config is not found, |
| 16982 | * or a negative error code |
| 16983 | * Based on ALC880 version - had to change it to override |
| 16984 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16985 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16986 | { |
| 16987 | struct alc_spec *spec = codec->spec; |
| 16988 | int err; |
| 16989 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16990 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16991 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16992 | alc861vd_ignore); |
| 16993 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16994 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16995 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16996 | return 0; /* can't find valid BIOS pin config */ |
| 16997 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16998 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16999 | if (err < 0) |
| 17000 | return err; |
| 17001 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17002 | if (err < 0) |
| 17003 | return err; |
| 17004 | err = alc861vd_auto_create_extra_out(spec, |
| 17005 | spec->autocfg.speaker_pins[0], |
| 17006 | "Speaker"); |
| 17007 | if (err < 0) |
| 17008 | return err; |
| 17009 | err = alc861vd_auto_create_extra_out(spec, |
| 17010 | spec->autocfg.hp_pins[0], |
| 17011 | "Headphone"); |
| 17012 | if (err < 0) |
| 17013 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17014 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17015 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17016 | return err; |
| 17017 | |
| 17018 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17019 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17020 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17021 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17022 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17023 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17024 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17025 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17026 | |
| 17027 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17028 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17029 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17030 | err = alc_auto_add_mic_boost(codec); |
| 17031 | if (err < 0) |
| 17032 | return err; |
| 17033 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17034 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17035 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17036 | return 1; |
| 17037 | } |
| 17038 | |
| 17039 | /* additional initialization for auto-configuration model */ |
| 17040 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17041 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17042 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17043 | alc861vd_auto_init_multi_out(codec); |
| 17044 | alc861vd_auto_init_hp_out(codec); |
| 17045 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17046 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17047 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17048 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17049 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17050 | } |
| 17051 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17052 | enum { |
| 17053 | ALC660VD_FIX_ASUS_GPIO1 |
| 17054 | }; |
| 17055 | |
| 17056 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17057 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17058 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17059 | .verbs = (const struct hda_verb[]) { |
| 17060 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17061 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17062 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17063 | { } |
| 17064 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17065 | }, |
| 17066 | }; |
| 17067 | |
| 17068 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17069 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17070 | {} |
| 17071 | }; |
| 17072 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17073 | static int patch_alc861vd(struct hda_codec *codec) |
| 17074 | { |
| 17075 | struct alc_spec *spec; |
| 17076 | int err, board_config; |
| 17077 | |
| 17078 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17079 | if (spec == NULL) |
| 17080 | return -ENOMEM; |
| 17081 | |
| 17082 | codec->spec = spec; |
| 17083 | |
| 17084 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17085 | alc861vd_models, |
| 17086 | alc861vd_cfg_tbl); |
| 17087 | |
| 17088 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17089 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17090 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17091 | board_config = ALC861VD_AUTO; |
| 17092 | } |
| 17093 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17094 | if (board_config == ALC861VD_AUTO) |
| 17095 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17096 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17097 | if (board_config == ALC861VD_AUTO) { |
| 17098 | /* automatic parse from the BIOS config */ |
| 17099 | err = alc861vd_parse_auto_config(codec); |
| 17100 | if (err < 0) { |
| 17101 | alc_free(codec); |
| 17102 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17103 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17104 | printk(KERN_INFO |
| 17105 | "hda_codec: Cannot set up configuration " |
| 17106 | "from BIOS. Using base mode...\n"); |
| 17107 | board_config = ALC861VD_3ST; |
| 17108 | } |
| 17109 | } |
| 17110 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17111 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17112 | if (err < 0) { |
| 17113 | alc_free(codec); |
| 17114 | return err; |
| 17115 | } |
| 17116 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17117 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17118 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17119 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17120 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17121 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17122 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17123 | } |
| 17124 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17125 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17126 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17127 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17128 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17129 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17130 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17131 | if (!spec->adc_nids) { |
| 17132 | spec->adc_nids = alc861vd_adc_nids; |
| 17133 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17134 | } |
| 17135 | if (!spec->capsrc_nids) |
| 17136 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17137 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17138 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17139 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17140 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17141 | spec->vmaster_nid = 0x02; |
| 17142 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17143 | if (board_config == ALC861VD_AUTO) |
| 17144 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 17145 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17146 | codec->patch_ops = alc_patch_ops; |
| 17147 | |
| 17148 | if (board_config == ALC861VD_AUTO) |
| 17149 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17150 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17151 | if (!spec->loopback.amplist) |
| 17152 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17153 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17154 | |
| 17155 | return 0; |
| 17156 | } |
| 17157 | |
| 17158 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17159 | * ALC662 support |
| 17160 | * |
| 17161 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17162 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17163 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17164 | * 6-channel independent captures. |
| 17165 | * |
| 17166 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17167 | * driver yet). |
| 17168 | */ |
| 17169 | #define ALC662_DIGOUT_NID 0x06 |
| 17170 | #define ALC662_DIGIN_NID 0x0a |
| 17171 | |
| 17172 | static hda_nid_t alc662_dac_nids[4] = { |
| 17173 | /* front, rear, clfe, rear_surr */ |
| 17174 | 0x02, 0x03, 0x04 |
| 17175 | }; |
| 17176 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17177 | static hda_nid_t alc272_dac_nids[2] = { |
| 17178 | 0x02, 0x03 |
| 17179 | }; |
| 17180 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17181 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17182 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17183 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17184 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17185 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17186 | static hda_nid_t alc272_adc_nids[1] = { |
| 17187 | /* ADC1-2 */ |
| 17188 | 0x08, |
| 17189 | }; |
| 17190 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17191 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17192 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17193 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17194 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17195 | /* input MUX */ |
| 17196 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17197 | static struct hda_input_mux alc662_capture_source = { |
| 17198 | .num_items = 4, |
| 17199 | .items = { |
| 17200 | { "Mic", 0x0 }, |
| 17201 | { "Front Mic", 0x1 }, |
| 17202 | { "Line", 0x2 }, |
| 17203 | { "CD", 0x4 }, |
| 17204 | }, |
| 17205 | }; |
| 17206 | |
| 17207 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17208 | .num_items = 2, |
| 17209 | .items = { |
| 17210 | { "Mic", 0x1 }, |
| 17211 | { "Line", 0x2 }, |
| 17212 | }, |
| 17213 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17214 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17215 | static struct hda_input_mux alc663_capture_source = { |
| 17216 | .num_items = 3, |
| 17217 | .items = { |
| 17218 | { "Mic", 0x0 }, |
| 17219 | { "Front Mic", 0x1 }, |
| 17220 | { "Line", 0x2 }, |
| 17221 | }, |
| 17222 | }; |
| 17223 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17224 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17225 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17226 | .num_items = 16, |
| 17227 | .items = { |
| 17228 | { "Autoselect Mic", 0x0 }, |
| 17229 | { "Internal Mic", 0x1 }, |
| 17230 | { "In-0x02", 0x2 }, |
| 17231 | { "In-0x03", 0x3 }, |
| 17232 | { "In-0x04", 0x4 }, |
| 17233 | { "In-0x05", 0x5 }, |
| 17234 | { "In-0x06", 0x6 }, |
| 17235 | { "In-0x07", 0x7 }, |
| 17236 | { "In-0x08", 0x8 }, |
| 17237 | { "In-0x09", 0x9 }, |
| 17238 | { "In-0x0a", 0x0a }, |
| 17239 | { "In-0x0b", 0x0b }, |
| 17240 | { "In-0x0c", 0x0c }, |
| 17241 | { "In-0x0d", 0x0d }, |
| 17242 | { "In-0x0e", 0x0e }, |
| 17243 | { "In-0x0f", 0x0f }, |
| 17244 | }, |
| 17245 | }; |
| 17246 | #endif |
| 17247 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17248 | /* |
| 17249 | * 2ch mode |
| 17250 | */ |
| 17251 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17252 | { 2, NULL } |
| 17253 | }; |
| 17254 | |
| 17255 | /* |
| 17256 | * 2ch mode |
| 17257 | */ |
| 17258 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17259 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17260 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17261 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17262 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17263 | { } /* end */ |
| 17264 | }; |
| 17265 | |
| 17266 | /* |
| 17267 | * 6ch mode |
| 17268 | */ |
| 17269 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17270 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17271 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17272 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17273 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17274 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17275 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17276 | { } /* end */ |
| 17277 | }; |
| 17278 | |
| 17279 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17280 | { 2, alc662_3ST_ch2_init }, |
| 17281 | { 6, alc662_3ST_ch6_init }, |
| 17282 | }; |
| 17283 | |
| 17284 | /* |
| 17285 | * 2ch mode |
| 17286 | */ |
| 17287 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17288 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17289 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17290 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17291 | { } /* end */ |
| 17292 | }; |
| 17293 | |
| 17294 | /* |
| 17295 | * 6ch mode |
| 17296 | */ |
| 17297 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17298 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17299 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17300 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17301 | { } /* end */ |
| 17302 | }; |
| 17303 | |
| 17304 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17305 | { 2, alc662_sixstack_ch6_init }, |
| 17306 | { 6, alc662_sixstack_ch8_init }, |
| 17307 | }; |
| 17308 | |
| 17309 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17310 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17311 | */ |
| 17312 | |
| 17313 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17314 | /* output mixer control */ |
| 17315 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17316 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17317 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17318 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17319 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17320 | 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] | 17321 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17322 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17323 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17324 | |
| 17325 | /*Input mixer control */ |
| 17326 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17327 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17328 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17329 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17330 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17331 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17332 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17333 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17334 | { } /* end */ |
| 17335 | }; |
| 17336 | |
| 17337 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17338 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17339 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17340 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17341 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17342 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17343 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17344 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17345 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17346 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17347 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17348 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17349 | { } /* end */ |
| 17350 | }; |
| 17351 | |
| 17352 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17353 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17354 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17355 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17356 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17357 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17358 | 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] | 17359 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17360 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17361 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17362 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17363 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17364 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17365 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17368 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17369 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17370 | { } /* end */ |
| 17371 | }; |
| 17372 | |
| 17373 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17374 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17375 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17376 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17377 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17378 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17379 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17380 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17381 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17382 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17383 | { } /* end */ |
| 17384 | }; |
| 17385 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17386 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17387 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17388 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17389 | |
| 17390 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17391 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17392 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17393 | |
| 17394 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17395 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17396 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17397 | { } /* end */ |
| 17398 | }; |
| 17399 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17400 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17401 | ALC262_HIPPO_MASTER_SWITCH, |
| 17402 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17403 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17404 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17405 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17406 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17407 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17408 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17409 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17410 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17411 | { } /* end */ |
| 17412 | }; |
| 17413 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17414 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17415 | .ops = &snd_hda_bind_vol, |
| 17416 | .values = { |
| 17417 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17418 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17419 | 0 |
| 17420 | }, |
| 17421 | }; |
| 17422 | |
| 17423 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17424 | .ops = &snd_hda_bind_sw, |
| 17425 | .values = { |
| 17426 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17427 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17428 | 0 |
| 17429 | }, |
| 17430 | }; |
| 17431 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17432 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17433 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17434 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17437 | { } /* end */ |
| 17438 | }; |
| 17439 | |
| 17440 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17441 | .ops = &snd_hda_bind_sw, |
| 17442 | .values = { |
| 17443 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17444 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17445 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17446 | 0 |
| 17447 | }, |
| 17448 | }; |
| 17449 | |
| 17450 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17451 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17452 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17453 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17454 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17455 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17456 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17457 | |
| 17458 | { } /* end */ |
| 17459 | }; |
| 17460 | |
| 17461 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17462 | .ops = &snd_hda_bind_sw, |
| 17463 | .values = { |
| 17464 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17465 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17466 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17467 | 0 |
| 17468 | }, |
| 17469 | }; |
| 17470 | |
| 17471 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17472 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17473 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17475 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17476 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17477 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17478 | { } /* end */ |
| 17479 | }; |
| 17480 | |
| 17481 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17482 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17483 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17484 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17485 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17486 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17487 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17488 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17489 | { } /* end */ |
| 17490 | }; |
| 17491 | |
| 17492 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17493 | .ops = &snd_hda_bind_vol, |
| 17494 | .values = { |
| 17495 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17496 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17497 | 0 |
| 17498 | }, |
| 17499 | }; |
| 17500 | |
| 17501 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17502 | .ops = &snd_hda_bind_sw, |
| 17503 | .values = { |
| 17504 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17505 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17506 | 0 |
| 17507 | }, |
| 17508 | }; |
| 17509 | |
| 17510 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17511 | HDA_BIND_VOL("Master Playback Volume", |
| 17512 | &alc663_asus_two_bind_master_vol), |
| 17513 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17514 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17516 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17517 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17518 | { } /* end */ |
| 17519 | }; |
| 17520 | |
| 17521 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17522 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17523 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17524 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17525 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17526 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17527 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17528 | { } /* end */ |
| 17529 | }; |
| 17530 | |
| 17531 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17532 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17533 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17534 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17535 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17536 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17537 | |
| 17538 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17539 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17540 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17541 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17542 | { } /* end */ |
| 17543 | }; |
| 17544 | |
| 17545 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17546 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17547 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17549 | |
| 17550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17552 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17553 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17554 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17555 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17556 | { } /* end */ |
| 17557 | }; |
| 17558 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17559 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17560 | .ops = &snd_hda_bind_sw, |
| 17561 | .values = { |
| 17562 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17563 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17564 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17565 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17566 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17567 | 0 |
| 17568 | }, |
| 17569 | }; |
| 17570 | |
| 17571 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17572 | .ops = &snd_hda_bind_sw, |
| 17573 | .values = { |
| 17574 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17575 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17576 | 0 |
| 17577 | }, |
| 17578 | }; |
| 17579 | |
| 17580 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17581 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17582 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17583 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17584 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17585 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17586 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17587 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17588 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17589 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17590 | { } /* end */ |
| 17591 | }; |
| 17592 | |
| 17593 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17594 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17595 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17596 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17597 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17598 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17599 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17600 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17601 | { } /* end */ |
| 17602 | }; |
| 17603 | |
| 17604 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17605 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17606 | { |
| 17607 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17608 | .name = "Channel Mode", |
| 17609 | .info = alc_ch_mode_info, |
| 17610 | .get = alc_ch_mode_get, |
| 17611 | .put = alc_ch_mode_put, |
| 17612 | }, |
| 17613 | { } /* end */ |
| 17614 | }; |
| 17615 | |
| 17616 | static struct hda_verb alc662_init_verbs[] = { |
| 17617 | /* ADC: mute amp left and right */ |
| 17618 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17619 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17620 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17621 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17622 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17623 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17624 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17625 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17626 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17627 | |
| 17628 | /* Front Pin: output 0 (0x0c) */ |
| 17629 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17630 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17631 | |
| 17632 | /* Rear Pin: output 1 (0x0d) */ |
| 17633 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17634 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17635 | |
| 17636 | /* CLFE Pin: output 2 (0x0e) */ |
| 17637 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17638 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17639 | |
| 17640 | /* Mic (rear) pin: input vref at 80% */ |
| 17641 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17642 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17643 | /* Front Mic pin: input vref at 80% */ |
| 17644 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17645 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17646 | /* Line In pin: input */ |
| 17647 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17649 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17650 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17651 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17652 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17653 | /* CD pin widget for input */ |
| 17654 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17655 | |
| 17656 | /* FIXME: use matrix-type input source selection */ |
| 17657 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17658 | /* Input mixer */ |
| 17659 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17660 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17661 | |
| 17662 | /* always trun on EAPD */ |
| 17663 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17664 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17665 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17666 | { } |
| 17667 | }; |
| 17668 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17669 | static struct hda_verb alc663_init_verbs[] = { |
| 17670 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17671 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17672 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17673 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17674 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17675 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17676 | { } |
| 17677 | }; |
| 17678 | |
| 17679 | static struct hda_verb alc272_init_verbs[] = { |
| 17680 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17681 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17682 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17683 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17684 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17685 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17686 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17687 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17688 | { } |
| 17689 | }; |
| 17690 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17691 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17692 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17693 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17694 | {} |
| 17695 | }; |
| 17696 | |
| 17697 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17698 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17699 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17700 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17701 | }; |
| 17702 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17703 | /* Set Unsolicited Event*/ |
| 17704 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17705 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17706 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17707 | {} |
| 17708 | }; |
| 17709 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17710 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17712 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17713 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17714 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17715 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17716 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17717 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17718 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17719 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17720 | {} |
| 17721 | }; |
| 17722 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17723 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17724 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17725 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17726 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17729 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17730 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17731 | {} |
| 17732 | }; |
| 17733 | |
| 17734 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17735 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17736 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17737 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17738 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17739 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17740 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17741 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17742 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17743 | {} |
| 17744 | }; |
| 17745 | |
| 17746 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17747 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17748 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17749 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17750 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17751 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17752 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17753 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17754 | {} |
| 17755 | }; |
| 17756 | |
| 17757 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17758 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17759 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17760 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17761 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17762 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17763 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17764 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17765 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17766 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17767 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17768 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17769 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17770 | {} |
| 17771 | }; |
| 17772 | |
| 17773 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17774 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17775 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17776 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17777 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17778 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17779 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17780 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17781 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17782 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17783 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17784 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17785 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17786 | {} |
| 17787 | }; |
| 17788 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17789 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17791 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17792 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17793 | |
| 17794 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17795 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17796 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17797 | |
| 17798 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17799 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17800 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17801 | {} |
| 17802 | }; |
| 17803 | |
| 17804 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17805 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17806 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17807 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17808 | |
| 17809 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17810 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17811 | {} |
| 17812 | }; |
| 17813 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17814 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17815 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17817 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17818 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17819 | {} |
| 17820 | }; |
| 17821 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17822 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17823 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17824 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17825 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17826 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17827 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17828 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17829 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17830 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17831 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17832 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17833 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17834 | {} |
| 17835 | }; |
| 17836 | |
| 17837 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17838 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17839 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17840 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17841 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17842 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17843 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17844 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17845 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17846 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17847 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17848 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17849 | {} |
| 17850 | }; |
| 17851 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17852 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17853 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17854 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17855 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17856 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17857 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17858 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17859 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17860 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17861 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17862 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17863 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17864 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17865 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17866 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17867 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17868 | {} |
| 17869 | }; |
| 17870 | |
| 17871 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17872 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17875 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17876 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17877 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17878 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17879 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17880 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17881 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17882 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17883 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17884 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17885 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17886 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17887 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17888 | {} |
| 17889 | }; |
| 17890 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17891 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17892 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17893 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17894 | { } /* end */ |
| 17895 | }; |
| 17896 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17897 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17898 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17899 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17900 | { } /* end */ |
| 17901 | }; |
| 17902 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17903 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17904 | { |
| 17905 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17906 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17907 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17908 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17909 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17910 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17911 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17912 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17913 | } |
| 17914 | |
| 17915 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17916 | { |
| 17917 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17918 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17919 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17920 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17921 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17922 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17923 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17924 | HDA_AMP_MUTE, bits); |
| 17925 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17926 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17927 | } |
| 17928 | |
| 17929 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17930 | unsigned int res) |
| 17931 | { |
| 17932 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17933 | alc662_lenovo_101e_all_automute(codec); |
| 17934 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17935 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17936 | } |
| 17937 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17938 | /* unsolicited event for HP jack sensing */ |
| 17939 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17940 | unsigned int res) |
| 17941 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17942 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17943 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17944 | else |
| 17945 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17946 | } |
| 17947 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17948 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17949 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17950 | struct alc_spec *spec = codec->spec; |
| 17951 | |
| 17952 | alc262_hippo1_setup(codec); |
| 17953 | spec->ext_mic.pin = 0x18; |
| 17954 | spec->ext_mic.mux_idx = 0; |
| 17955 | spec->int_mic.pin = 0x19; |
| 17956 | spec->int_mic.mux_idx = 1; |
| 17957 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17958 | } |
| 17959 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17960 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17961 | { |
| 17962 | alc262_hippo_automute(codec); |
| 17963 | alc_mic_automute(codec); |
| 17964 | } |
| 17965 | |
| 17966 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17967 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17968 | struct alc_spec *spec = codec->spec; |
| 17969 | |
| 17970 | spec->autocfg.hp_pins[0] = 0x14; |
| 17971 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17972 | } |
| 17973 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17974 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17975 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17976 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17977 | { |
| 17978 | unsigned int present; |
| 17979 | unsigned char bits; |
| 17980 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17981 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17982 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17983 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17984 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17985 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17986 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17987 | } |
| 17988 | |
| 17989 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17990 | { |
| 17991 | unsigned int present; |
| 17992 | unsigned char bits; |
| 17993 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17994 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17995 | bits = present ? HDA_AMP_MUTE : 0; |
| 17996 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17997 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17998 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17999 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18000 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18001 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18002 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18003 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18004 | } |
| 18005 | |
| 18006 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18007 | { |
| 18008 | unsigned int present; |
| 18009 | unsigned char bits; |
| 18010 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18011 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18012 | bits = present ? HDA_AMP_MUTE : 0; |
| 18013 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18014 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18015 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18016 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18017 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18018 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18019 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18020 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18021 | } |
| 18022 | |
| 18023 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18024 | { |
| 18025 | unsigned int present; |
| 18026 | unsigned char bits; |
| 18027 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18028 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18029 | bits = present ? 0 : PIN_OUT; |
| 18030 | snd_hda_codec_write(codec, 0x14, 0, |
| 18031 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18032 | } |
| 18033 | |
| 18034 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18035 | { |
| 18036 | unsigned int present1, present2; |
| 18037 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18038 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18039 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18040 | |
| 18041 | if (present1 || present2) { |
| 18042 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18043 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18044 | } else { |
| 18045 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18046 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18047 | } |
| 18048 | } |
| 18049 | |
| 18050 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18051 | { |
| 18052 | unsigned int present1, present2; |
| 18053 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18054 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18055 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18056 | |
| 18057 | if (present1 || present2) { |
| 18058 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18059 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18060 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18061 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18062 | } else { |
| 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, 0); |
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, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18067 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18068 | } |
| 18069 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18070 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18071 | { |
| 18072 | unsigned int present1, present2; |
| 18073 | |
| 18074 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18075 | AC_VERB_GET_PIN_SENSE, 0) |
| 18076 | & AC_PINSENSE_PRESENCE; |
| 18077 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18078 | AC_VERB_GET_PIN_SENSE, 0) |
| 18079 | & AC_PINSENSE_PRESENCE; |
| 18080 | |
| 18081 | if (present1 || present2) { |
| 18082 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18083 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18084 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18085 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18086 | } else { |
| 18087 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18088 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18089 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18090 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18091 | } |
| 18092 | } |
| 18093 | |
| 18094 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18095 | { |
| 18096 | unsigned int present1, present2; |
| 18097 | |
| 18098 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18099 | AC_VERB_GET_PIN_SENSE, 0) |
| 18100 | & AC_PINSENSE_PRESENCE; |
| 18101 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18102 | AC_VERB_GET_PIN_SENSE, 0) |
| 18103 | & AC_PINSENSE_PRESENCE; |
| 18104 | |
| 18105 | if (present1 || present2) { |
| 18106 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18107 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18108 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18109 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18110 | } else { |
| 18111 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18112 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18113 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18114 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18115 | } |
| 18116 | } |
| 18117 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18118 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18119 | unsigned int res) |
| 18120 | { |
| 18121 | switch (res >> 26) { |
| 18122 | case ALC880_HP_EVENT: |
| 18123 | alc663_m51va_speaker_automute(codec); |
| 18124 | break; |
| 18125 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18126 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18127 | break; |
| 18128 | } |
| 18129 | } |
| 18130 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18131 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18132 | { |
| 18133 | struct alc_spec *spec = codec->spec; |
| 18134 | spec->ext_mic.pin = 0x18; |
| 18135 | spec->ext_mic.mux_idx = 0; |
| 18136 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18137 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18138 | spec->auto_mic = 1; |
| 18139 | } |
| 18140 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18141 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18142 | { |
| 18143 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18144 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18145 | } |
| 18146 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18147 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18148 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18149 | |
| 18150 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18151 | { |
| 18152 | struct alc_spec *spec = codec->spec; |
| 18153 | spec->ext_mic.pin = 0x18; |
| 18154 | spec->ext_mic.mux_idx = 0; |
| 18155 | spec->int_mic.pin = 0x19; |
| 18156 | spec->int_mic.mux_idx = 1; |
| 18157 | spec->auto_mic = 1; |
| 18158 | } |
| 18159 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18160 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18161 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18162 | /* ***************** Mode2 ******************************/ |
| 18163 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18164 | unsigned int res) |
| 18165 | { |
| 18166 | switch (res >> 26) { |
| 18167 | case ALC880_HP_EVENT: |
| 18168 | alc662_f5z_speaker_automute(codec); |
| 18169 | break; |
| 18170 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18171 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18172 | break; |
| 18173 | } |
| 18174 | } |
| 18175 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18176 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18177 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18178 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18179 | { |
| 18180 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18181 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18182 | } |
| 18183 | /* ***************** Mode3 ******************************/ |
| 18184 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18185 | unsigned int res) |
| 18186 | { |
| 18187 | switch (res >> 26) { |
| 18188 | case ALC880_HP_EVENT: |
| 18189 | alc663_two_hp_m1_speaker_automute(codec); |
| 18190 | break; |
| 18191 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18192 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18193 | break; |
| 18194 | } |
| 18195 | } |
| 18196 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18197 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18198 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18199 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18200 | { |
| 18201 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18202 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18203 | } |
| 18204 | /* ***************** Mode4 ******************************/ |
| 18205 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18206 | unsigned int res) |
| 18207 | { |
| 18208 | switch (res >> 26) { |
| 18209 | case ALC880_HP_EVENT: |
| 18210 | alc663_21jd_two_speaker_automute(codec); |
| 18211 | break; |
| 18212 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18213 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18214 | break; |
| 18215 | } |
| 18216 | } |
| 18217 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18218 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18219 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18220 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18221 | { |
| 18222 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18223 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18224 | } |
| 18225 | /* ***************** Mode5 ******************************/ |
| 18226 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18227 | unsigned int res) |
| 18228 | { |
| 18229 | switch (res >> 26) { |
| 18230 | case ALC880_HP_EVENT: |
| 18231 | alc663_15jd_two_speaker_automute(codec); |
| 18232 | break; |
| 18233 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18234 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18235 | break; |
| 18236 | } |
| 18237 | } |
| 18238 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18239 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18240 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18241 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18242 | { |
| 18243 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18244 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18245 | } |
| 18246 | /* ***************** Mode6 ******************************/ |
| 18247 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18248 | unsigned int res) |
| 18249 | { |
| 18250 | switch (res >> 26) { |
| 18251 | case ALC880_HP_EVENT: |
| 18252 | alc663_two_hp_m2_speaker_automute(codec); |
| 18253 | break; |
| 18254 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18255 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18256 | break; |
| 18257 | } |
| 18258 | } |
| 18259 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18260 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18261 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18262 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18263 | { |
| 18264 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18265 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18266 | } |
| 18267 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18268 | /* ***************** Mode7 ******************************/ |
| 18269 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18270 | unsigned int res) |
| 18271 | { |
| 18272 | switch (res >> 26) { |
| 18273 | case ALC880_HP_EVENT: |
| 18274 | alc663_two_hp_m7_speaker_automute(codec); |
| 18275 | break; |
| 18276 | case ALC880_MIC_EVENT: |
| 18277 | alc_mic_automute(codec); |
| 18278 | break; |
| 18279 | } |
| 18280 | } |
| 18281 | |
| 18282 | #define alc663_mode7_setup alc663_mode1_setup |
| 18283 | |
| 18284 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18285 | { |
| 18286 | alc663_two_hp_m7_speaker_automute(codec); |
| 18287 | alc_mic_automute(codec); |
| 18288 | } |
| 18289 | |
| 18290 | /* ***************** Mode8 ******************************/ |
| 18291 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18292 | unsigned int res) |
| 18293 | { |
| 18294 | switch (res >> 26) { |
| 18295 | case ALC880_HP_EVENT: |
| 18296 | alc663_two_hp_m8_speaker_automute(codec); |
| 18297 | break; |
| 18298 | case ALC880_MIC_EVENT: |
| 18299 | alc_mic_automute(codec); |
| 18300 | break; |
| 18301 | } |
| 18302 | } |
| 18303 | |
| 18304 | #define alc663_mode8_setup alc663_m51va_setup |
| 18305 | |
| 18306 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18307 | { |
| 18308 | alc663_two_hp_m8_speaker_automute(codec); |
| 18309 | alc_mic_automute(codec); |
| 18310 | } |
| 18311 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18312 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18313 | { |
| 18314 | unsigned int present; |
| 18315 | unsigned char bits; |
| 18316 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18317 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18318 | bits = present ? HDA_AMP_MUTE : 0; |
| 18319 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18320 | HDA_AMP_MUTE, bits); |
| 18321 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18322 | HDA_AMP_MUTE, bits); |
| 18323 | } |
| 18324 | |
| 18325 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18326 | { |
| 18327 | unsigned int present; |
| 18328 | unsigned char bits; |
| 18329 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18330 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18331 | bits = present ? HDA_AMP_MUTE : 0; |
| 18332 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18333 | HDA_AMP_MUTE, bits); |
| 18334 | } |
| 18335 | |
| 18336 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18337 | unsigned int res) |
| 18338 | { |
| 18339 | switch (res >> 26) { |
| 18340 | case ALC880_HP_EVENT: |
| 18341 | alc663_g71v_hp_automute(codec); |
| 18342 | break; |
| 18343 | case ALC880_FRONT_EVENT: |
| 18344 | alc663_g71v_front_automute(codec); |
| 18345 | break; |
| 18346 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18347 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18348 | break; |
| 18349 | } |
| 18350 | } |
| 18351 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18352 | #define alc663_g71v_setup alc663_m51va_setup |
| 18353 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18354 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18355 | { |
| 18356 | alc663_g71v_front_automute(codec); |
| 18357 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18358 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18359 | } |
| 18360 | |
| 18361 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18362 | unsigned int res) |
| 18363 | { |
| 18364 | switch (res >> 26) { |
| 18365 | case ALC880_HP_EVENT: |
| 18366 | alc663_m51va_speaker_automute(codec); |
| 18367 | break; |
| 18368 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18369 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18370 | break; |
| 18371 | } |
| 18372 | } |
| 18373 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18374 | #define alc663_g50v_setup alc663_m51va_setup |
| 18375 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18376 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18377 | { |
| 18378 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18379 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18380 | } |
| 18381 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18382 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18383 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18384 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18385 | |
| 18386 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18387 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18388 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18389 | |
| 18390 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18391 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18392 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18393 | { } /* end */ |
| 18394 | }; |
| 18395 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18396 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18397 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18398 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18399 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18400 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18401 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18402 | |
| 18403 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18404 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18405 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18406 | |
| 18407 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18408 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18409 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18410 | { } /* end */ |
| 18411 | }; |
| 18412 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18413 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18414 | #define alc662_loopbacks alc880_loopbacks |
| 18415 | #endif |
| 18416 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18417 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18418 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18419 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18420 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18421 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18422 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18423 | |
| 18424 | /* |
| 18425 | * configuration and preset |
| 18426 | */ |
| 18427 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18428 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18429 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18430 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18431 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18432 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18433 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18434 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18435 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18436 | [ALC663_ASUS_M51VA] = "m51va", |
| 18437 | [ALC663_ASUS_G71V] = "g71v", |
| 18438 | [ALC663_ASUS_H13] = "h13", |
| 18439 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18440 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18441 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18442 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18443 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18444 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18445 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18446 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18447 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18448 | [ALC272_DELL] = "dell", |
| 18449 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18450 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18451 | [ALC662_AUTO] = "auto", |
| 18452 | }; |
| 18453 | |
| 18454 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18455 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18456 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18457 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18458 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18459 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18460 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18461 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18462 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18463 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18464 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18465 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18466 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18467 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18468 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18469 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18470 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18471 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18472 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18473 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18474 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18475 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18476 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18477 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18478 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18479 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18480 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18481 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18482 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18483 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18484 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18485 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18486 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18487 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18488 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18489 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18490 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18491 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18492 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18493 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18494 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18495 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18496 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18497 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18498 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18499 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18500 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18501 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18502 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18503 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18504 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18505 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18506 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18507 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18508 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18509 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18510 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18511 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18512 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18513 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18514 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18515 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18516 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18517 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18518 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18519 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18520 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18521 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18522 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18523 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18524 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18525 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18526 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18527 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18528 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18529 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18530 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18531 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18532 | {} |
| 18533 | }; |
| 18534 | |
| 18535 | static struct alc_config_preset alc662_presets[] = { |
| 18536 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18537 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18538 | .init_verbs = { alc662_init_verbs }, |
| 18539 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18540 | .dac_nids = alc662_dac_nids, |
| 18541 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18542 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18543 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18544 | .channel_mode = alc662_3ST_2ch_modes, |
| 18545 | .input_mux = &alc662_capture_source, |
| 18546 | }, |
| 18547 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18548 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18549 | .init_verbs = { alc662_init_verbs }, |
| 18550 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18551 | .dac_nids = alc662_dac_nids, |
| 18552 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18553 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18554 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18555 | .channel_mode = alc662_3ST_6ch_modes, |
| 18556 | .need_dac_fix = 1, |
| 18557 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18558 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18559 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18560 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18561 | .init_verbs = { alc662_init_verbs }, |
| 18562 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18563 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18564 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18565 | .channel_mode = alc662_3ST_6ch_modes, |
| 18566 | .need_dac_fix = 1, |
| 18567 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18568 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18569 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18570 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18571 | .init_verbs = { alc662_init_verbs }, |
| 18572 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18573 | .dac_nids = alc662_dac_nids, |
| 18574 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18575 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18576 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18577 | .channel_mode = alc662_5stack_modes, |
| 18578 | .input_mux = &alc662_capture_source, |
| 18579 | }, |
| 18580 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18581 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18582 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18583 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18584 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18585 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18586 | .channel_mode = alc662_3ST_2ch_modes, |
| 18587 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18588 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18589 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18590 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18591 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18592 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18593 | .init_verbs = { alc662_init_verbs, |
| 18594 | alc662_eeepc_sue_init_verbs }, |
| 18595 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18596 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18597 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18598 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18599 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18600 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18601 | .init_hook = alc662_eeepc_inithook, |
| 18602 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18603 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18604 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18605 | alc662_chmode_mixer }, |
| 18606 | .init_verbs = { alc662_init_verbs, |
| 18607 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18608 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18609 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18610 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18611 | .channel_mode = alc662_3ST_6ch_modes, |
| 18612 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18613 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18614 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18615 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18616 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18617 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18618 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18619 | .init_verbs = { alc662_init_verbs, |
| 18620 | alc662_ecs_init_verbs }, |
| 18621 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18622 | .dac_nids = alc662_dac_nids, |
| 18623 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18624 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18625 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18626 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18627 | .init_hook = alc662_eeepc_inithook, |
| 18628 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18629 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18630 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18631 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18632 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18633 | .dac_nids = alc662_dac_nids, |
| 18634 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18635 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18636 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18637 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18638 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18639 | .init_hook = alc663_m51va_inithook, |
| 18640 | }, |
| 18641 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18642 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18643 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18644 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18645 | .dac_nids = alc662_dac_nids, |
| 18646 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18647 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18648 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18649 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18650 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18651 | .init_hook = alc663_g71v_inithook, |
| 18652 | }, |
| 18653 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18654 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18655 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18656 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18657 | .dac_nids = alc662_dac_nids, |
| 18658 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18659 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18660 | .unsol_event = alc663_m51va_unsol_event, |
| 18661 | .init_hook = alc663_m51va_inithook, |
| 18662 | }, |
| 18663 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18664 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18665 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18666 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18667 | .dac_nids = alc662_dac_nids, |
| 18668 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18669 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18670 | .channel_mode = alc662_3ST_6ch_modes, |
| 18671 | .input_mux = &alc663_capture_source, |
| 18672 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18673 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18674 | .init_hook = alc663_g50v_inithook, |
| 18675 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18676 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18677 | .mixers = { alc663_m51va_mixer }, |
| 18678 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18679 | .init_verbs = { alc662_init_verbs, |
| 18680 | alc663_21jd_amic_init_verbs }, |
| 18681 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18682 | .hp_nid = 0x03, |
| 18683 | .dac_nids = alc662_dac_nids, |
| 18684 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18685 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18686 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18687 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18688 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18689 | .init_hook = alc663_mode1_inithook, |
| 18690 | }, |
| 18691 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18692 | .mixers = { alc662_1bjd_mixer }, |
| 18693 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18694 | .init_verbs = { alc662_init_verbs, |
| 18695 | alc662_1bjd_amic_init_verbs }, |
| 18696 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18697 | .dac_nids = alc662_dac_nids, |
| 18698 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18699 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18700 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18701 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18702 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18703 | .init_hook = alc662_mode2_inithook, |
| 18704 | }, |
| 18705 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18706 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18707 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18708 | .init_verbs = { alc662_init_verbs, |
| 18709 | alc663_two_hp_amic_m1_init_verbs }, |
| 18710 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18711 | .hp_nid = 0x03, |
| 18712 | .dac_nids = alc662_dac_nids, |
| 18713 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18714 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18715 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18716 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18717 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18718 | .init_hook = alc663_mode3_inithook, |
| 18719 | }, |
| 18720 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18721 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18722 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18723 | .init_verbs = { alc662_init_verbs, |
| 18724 | alc663_21jd_amic_init_verbs}, |
| 18725 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18726 | .hp_nid = 0x03, |
| 18727 | .dac_nids = alc662_dac_nids, |
| 18728 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18729 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18730 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18731 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18732 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18733 | .init_hook = alc663_mode4_inithook, |
| 18734 | }, |
| 18735 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18736 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18737 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18738 | .init_verbs = { alc662_init_verbs, |
| 18739 | alc663_15jd_amic_init_verbs }, |
| 18740 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18741 | .hp_nid = 0x03, |
| 18742 | .dac_nids = alc662_dac_nids, |
| 18743 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18744 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18745 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18746 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18747 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18748 | .init_hook = alc663_mode5_inithook, |
| 18749 | }, |
| 18750 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18751 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18752 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18753 | .init_verbs = { alc662_init_verbs, |
| 18754 | alc663_two_hp_amic_m2_init_verbs }, |
| 18755 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18756 | .hp_nid = 0x03, |
| 18757 | .dac_nids = alc662_dac_nids, |
| 18758 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18759 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18760 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18761 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18762 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18763 | .init_hook = alc663_mode6_inithook, |
| 18764 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18765 | [ALC663_ASUS_MODE7] = { |
| 18766 | .mixers = { alc663_mode7_mixer }, |
| 18767 | .cap_mixer = alc662_auto_capture_mixer, |
| 18768 | .init_verbs = { alc662_init_verbs, |
| 18769 | alc663_mode7_init_verbs }, |
| 18770 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18771 | .hp_nid = 0x03, |
| 18772 | .dac_nids = alc662_dac_nids, |
| 18773 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18774 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18775 | .channel_mode = alc662_3ST_2ch_modes, |
| 18776 | .unsol_event = alc663_mode7_unsol_event, |
| 18777 | .setup = alc663_mode7_setup, |
| 18778 | .init_hook = alc663_mode7_inithook, |
| 18779 | }, |
| 18780 | [ALC663_ASUS_MODE8] = { |
| 18781 | .mixers = { alc663_mode8_mixer }, |
| 18782 | .cap_mixer = alc662_auto_capture_mixer, |
| 18783 | .init_verbs = { alc662_init_verbs, |
| 18784 | alc663_mode8_init_verbs }, |
| 18785 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18786 | .hp_nid = 0x03, |
| 18787 | .dac_nids = alc662_dac_nids, |
| 18788 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18789 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18790 | .channel_mode = alc662_3ST_2ch_modes, |
| 18791 | .unsol_event = alc663_mode8_unsol_event, |
| 18792 | .setup = alc663_mode8_setup, |
| 18793 | .init_hook = alc663_mode8_inithook, |
| 18794 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18795 | [ALC272_DELL] = { |
| 18796 | .mixers = { alc663_m51va_mixer }, |
| 18797 | .cap_mixer = alc272_auto_capture_mixer, |
| 18798 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18799 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18800 | .dac_nids = alc662_dac_nids, |
| 18801 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18802 | .adc_nids = alc272_adc_nids, |
| 18803 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18804 | .capsrc_nids = alc272_capsrc_nids, |
| 18805 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18806 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18807 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18808 | .init_hook = alc663_m51va_inithook, |
| 18809 | }, |
| 18810 | [ALC272_DELL_ZM1] = { |
| 18811 | .mixers = { alc663_m51va_mixer }, |
| 18812 | .cap_mixer = alc662_auto_capture_mixer, |
| 18813 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18814 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18815 | .dac_nids = alc662_dac_nids, |
| 18816 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18817 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18818 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18819 | .capsrc_nids = alc662_capsrc_nids, |
| 18820 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18821 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18822 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18823 | .init_hook = alc663_m51va_inithook, |
| 18824 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18825 | [ALC272_SAMSUNG_NC10] = { |
| 18826 | .mixers = { alc272_nc10_mixer }, |
| 18827 | .init_verbs = { alc662_init_verbs, |
| 18828 | alc663_21jd_amic_init_verbs }, |
| 18829 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18830 | .dac_nids = alc272_dac_nids, |
| 18831 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18832 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18833 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18834 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18835 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18836 | .init_hook = alc663_mode4_inithook, |
| 18837 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18838 | }; |
| 18839 | |
| 18840 | |
| 18841 | /* |
| 18842 | * BIOS auto configuration |
| 18843 | */ |
| 18844 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18845 | /* convert from MIX nid to DAC */ |
| 18846 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18847 | { |
| 18848 | if (nid == 0x0f) |
| 18849 | return 0x02; |
| 18850 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18851 | return nid - 0x0c + 0x02; |
| 18852 | else |
| 18853 | return 0; |
| 18854 | } |
| 18855 | |
| 18856 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18857 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18858 | hda_nid_t dac) |
| 18859 | { |
| 18860 | hda_nid_t mix[4]; |
| 18861 | int i, num; |
| 18862 | |
| 18863 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18864 | for (i = 0; i < num; i++) { |
| 18865 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18866 | return mix[i]; |
| 18867 | } |
| 18868 | return 0; |
| 18869 | } |
| 18870 | |
| 18871 | /* look for an empty DAC slot */ |
| 18872 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18873 | { |
| 18874 | struct alc_spec *spec = codec->spec; |
| 18875 | hda_nid_t srcs[5]; |
| 18876 | int i, j, num; |
| 18877 | |
| 18878 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18879 | if (num < 0) |
| 18880 | return 0; |
| 18881 | for (i = 0; i < num; i++) { |
| 18882 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18883 | if (!nid) |
| 18884 | continue; |
| 18885 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18886 | if (spec->multiout.dac_nids[j] == nid) |
| 18887 | break; |
| 18888 | if (j >= spec->multiout.num_dacs) |
| 18889 | return nid; |
| 18890 | } |
| 18891 | return 0; |
| 18892 | } |
| 18893 | |
| 18894 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18895 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18896 | const struct auto_pin_cfg *cfg) |
| 18897 | { |
| 18898 | struct alc_spec *spec = codec->spec; |
| 18899 | int i; |
| 18900 | hda_nid_t dac; |
| 18901 | |
| 18902 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18903 | for (i = 0; i < cfg->line_outs; i++) { |
| 18904 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18905 | if (!dac) |
| 18906 | continue; |
| 18907 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18908 | } |
| 18909 | return 0; |
| 18910 | } |
| 18911 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18912 | 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] | 18913 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18914 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18915 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18916 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18917 | } |
| 18918 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18919 | 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] | 18920 | hda_nid_t nid, unsigned int chs) |
| 18921 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18922 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18923 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18924 | } |
| 18925 | |
| 18926 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18927 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18928 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18929 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18930 | |
| 18931 | /* add playback controls from the parsed DAC table */ |
| 18932 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18933 | const struct auto_pin_cfg *cfg) |
| 18934 | { |
| 18935 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18936 | static const char *chname[4] = { |
| 18937 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18938 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18939 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18940 | int i, err; |
| 18941 | |
| 18942 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18943 | nid = spec->multiout.dac_nids[i]; |
| 18944 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18945 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18946 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18947 | if (!mix) |
| 18948 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18949 | if (i == 2) { |
| 18950 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18951 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18952 | if (err < 0) |
| 18953 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18954 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18955 | if (err < 0) |
| 18956 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18957 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18958 | if (err < 0) |
| 18959 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18960 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18961 | if (err < 0) |
| 18962 | return err; |
| 18963 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18964 | const char *pfx; |
| 18965 | if (cfg->line_outs == 1 && |
| 18966 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18967 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18968 | pfx = "Speaker"; |
| 18969 | else |
| 18970 | pfx = "PCM"; |
| 18971 | } else |
| 18972 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18973 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18974 | if (err < 0) |
| 18975 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18976 | if (cfg->line_outs == 1 && |
| 18977 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18978 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18979 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18980 | if (err < 0) |
| 18981 | return err; |
| 18982 | } |
| 18983 | } |
| 18984 | return 0; |
| 18985 | } |
| 18986 | |
| 18987 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18988 | /* return DAC nid if any new DAC is assigned */ |
| 18989 | 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] | 18990 | const char *pfx) |
| 18991 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18992 | struct alc_spec *spec = codec->spec; |
| 18993 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18994 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18995 | |
| 18996 | if (!pin) |
| 18997 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18998 | nid = alc662_look_for_dac(codec, pin); |
| 18999 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19000 | /* the corresponding DAC is already occupied */ |
| 19001 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19002 | return 0; /* no way */ |
| 19003 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19004 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19005 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19006 | } |
| 19007 | |
| 19008 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19009 | if (!mix) |
| 19010 | return 0; |
| 19011 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19012 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19013 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19014 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19015 | if (err < 0) |
| 19016 | return err; |
| 19017 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19018 | } |
| 19019 | |
| 19020 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19021 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19022 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19023 | |
| 19024 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19025 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19026 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19027 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19028 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19029 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19030 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19031 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19032 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19033 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19034 | if (num <= 1) |
| 19035 | return; |
| 19036 | for (i = 0; i < num; i++) { |
| 19037 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19038 | continue; |
| 19039 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19040 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19041 | } |
| 19042 | } |
| 19043 | |
| 19044 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19045 | { |
| 19046 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19047 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19048 | int i; |
| 19049 | |
| 19050 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19051 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19052 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19053 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19054 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19055 | } |
| 19056 | } |
| 19057 | |
| 19058 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19059 | { |
| 19060 | struct alc_spec *spec = codec->spec; |
| 19061 | hda_nid_t pin; |
| 19062 | |
| 19063 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19064 | if (pin) |
| 19065 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19066 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19067 | pin = spec->autocfg.speaker_pins[0]; |
| 19068 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19069 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19070 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19071 | } |
| 19072 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19073 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19074 | |
| 19075 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19076 | { |
| 19077 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19078 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19079 | int i; |
| 19080 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19081 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19082 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19083 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 19084 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19085 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19086 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19087 | snd_hda_codec_write(codec, nid, 0, |
| 19088 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19089 | AMP_OUT_MUTE); |
| 19090 | } |
| 19091 | } |
| 19092 | } |
| 19093 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19094 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19095 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19096 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19097 | { |
| 19098 | struct alc_spec *spec = codec->spec; |
| 19099 | int err; |
| 19100 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19101 | |
| 19102 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19103 | alc662_ignore); |
| 19104 | if (err < 0) |
| 19105 | return err; |
| 19106 | if (!spec->autocfg.line_outs) |
| 19107 | return 0; /* can't find valid BIOS pin config */ |
| 19108 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19109 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19110 | if (err < 0) |
| 19111 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19112 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19113 | if (err < 0) |
| 19114 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19115 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19116 | spec->autocfg.speaker_pins[0], |
| 19117 | "Speaker"); |
| 19118 | if (err < 0) |
| 19119 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19120 | if (err) |
| 19121 | spec->multiout.extra_out_nid[0] = err; |
| 19122 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19123 | "Headphone"); |
| 19124 | if (err < 0) |
| 19125 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19126 | if (err) |
| 19127 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19128 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19129 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19130 | return err; |
| 19131 | |
| 19132 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19133 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19134 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19135 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19136 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19137 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19138 | |
| 19139 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19140 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19141 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19142 | add_verb(spec, alc662_init_verbs); |
| 19143 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19144 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19145 | add_verb(spec, alc663_init_verbs); |
| 19146 | |
| 19147 | if (codec->vendor_id == 0x10ec0272) |
| 19148 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19149 | |
| 19150 | err = alc_auto_add_mic_boost(codec); |
| 19151 | if (err < 0) |
| 19152 | return err; |
| 19153 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19154 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19155 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19156 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19157 | else |
| 19158 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19159 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19160 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19161 | } |
| 19162 | |
| 19163 | /* additional initialization for auto-configuration model */ |
| 19164 | static void alc662_auto_init(struct hda_codec *codec) |
| 19165 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19166 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19167 | alc662_auto_init_multi_out(codec); |
| 19168 | alc662_auto_init_hp_out(codec); |
| 19169 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19170 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19171 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19172 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19173 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19174 | } |
| 19175 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19176 | enum { |
| 19177 | ALC662_FIXUP_IDEAPAD, |
| 19178 | }; |
| 19179 | |
| 19180 | static const struct alc_fixup alc662_fixups[] = { |
| 19181 | [ALC662_FIXUP_IDEAPAD] = { |
| 19182 | .pins = (const struct alc_pincfg[]) { |
| 19183 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19184 | { } |
| 19185 | } |
| 19186 | }, |
| 19187 | }; |
| 19188 | |
| 19189 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
| 19190 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19191 | {} |
| 19192 | }; |
| 19193 | |
| 19194 | |
| 19195 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19196 | static int patch_alc662(struct hda_codec *codec) |
| 19197 | { |
| 19198 | struct alc_spec *spec; |
| 19199 | int err, board_config; |
| 19200 | |
| 19201 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19202 | if (!spec) |
| 19203 | return -ENOMEM; |
| 19204 | |
| 19205 | codec->spec = spec; |
| 19206 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19207 | alc_auto_parse_customize_define(codec); |
| 19208 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19209 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19210 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19211 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 19212 | alc_codec_rename(codec, "ALC661"); |
| 19213 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 19214 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19215 | spec->cdefine.platform_type == 1) |
| 19216 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19217 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19218 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19219 | alc662_models, |
| 19220 | alc662_cfg_tbl); |
| 19221 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19222 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19223 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19224 | board_config = ALC662_AUTO; |
| 19225 | } |
| 19226 | |
| 19227 | if (board_config == ALC662_AUTO) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19228 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19229 | /* automatic parse from the BIOS config */ |
| 19230 | err = alc662_parse_auto_config(codec); |
| 19231 | if (err < 0) { |
| 19232 | alc_free(codec); |
| 19233 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19234 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19235 | printk(KERN_INFO |
| 19236 | "hda_codec: Cannot set up configuration " |
| 19237 | "from BIOS. Using base mode...\n"); |
| 19238 | board_config = ALC662_3ST_2ch_DIG; |
| 19239 | } |
| 19240 | } |
| 19241 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19242 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19243 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19244 | if (err < 0) { |
| 19245 | alc_free(codec); |
| 19246 | return err; |
| 19247 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19248 | } |
| 19249 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19250 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19251 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19252 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19253 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19254 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19255 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19256 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19257 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19258 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19259 | if (!spec->adc_nids) { |
| 19260 | spec->adc_nids = alc662_adc_nids; |
| 19261 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19262 | } |
| 19263 | if (!spec->capsrc_nids) |
| 19264 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19265 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19266 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19267 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19268 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19269 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19270 | switch (codec->vendor_id) { |
| 19271 | case 0x10ec0662: |
| 19272 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19273 | break; |
| 19274 | case 0x10ec0272: |
| 19275 | case 0x10ec0663: |
| 19276 | case 0x10ec0665: |
| 19277 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19278 | break; |
| 19279 | case 0x10ec0273: |
| 19280 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19281 | break; |
| 19282 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19283 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19284 | spec->vmaster_nid = 0x02; |
| 19285 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19286 | codec->patch_ops = alc_patch_ops; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19287 | if (board_config == ALC662_AUTO) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19288 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19289 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
| 19290 | } |
| 19291 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19292 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19293 | if (!spec->loopback.amplist) |
| 19294 | spec->loopback.amplist = alc662_loopbacks; |
| 19295 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19296 | |
| 19297 | return 0; |
| 19298 | } |
| 19299 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19300 | static int patch_alc888(struct hda_codec *codec) |
| 19301 | { |
| 19302 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19303 | kfree(codec->chip_name); |
| 19304 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19305 | if (!codec->chip_name) { |
| 19306 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19307 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19308 | } |
| 19309 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19310 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19311 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19312 | } |
| 19313 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19314 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19315 | * ALC680 support |
| 19316 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19317 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19318 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19319 | #define alc680_modes alc260_modes |
| 19320 | |
| 19321 | static hda_nid_t alc680_dac_nids[3] = { |
| 19322 | /* Lout1, Lout2, hp */ |
| 19323 | 0x02, 0x03, 0x04 |
| 19324 | }; |
| 19325 | |
| 19326 | static hda_nid_t alc680_adc_nids[3] = { |
| 19327 | /* ADC0-2 */ |
| 19328 | /* DMIC, MIC, Line-in*/ |
| 19329 | 0x07, 0x08, 0x09 |
| 19330 | }; |
| 19331 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19332 | /* |
| 19333 | * Analog capture ADC cgange |
| 19334 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19335 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19336 | { |
| 19337 | struct alc_spec *spec = codec->spec; |
| 19338 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19339 | int pin_found = 0; |
| 19340 | int type_found = AUTO_PIN_LAST; |
| 19341 | hda_nid_t nid; |
| 19342 | int i; |
| 19343 | |
| 19344 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19345 | nid = cfg->inputs[i].pin; |
| 19346 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19347 | AC_PINCAP_PRES_DETECT)) |
| 19348 | continue; |
| 19349 | if (snd_hda_jack_detect(codec, nid)) { |
| 19350 | if (cfg->inputs[i].type < type_found) { |
| 19351 | type_found = cfg->inputs[i].type; |
| 19352 | pin_found = nid; |
| 19353 | } |
| 19354 | } |
| 19355 | } |
| 19356 | |
| 19357 | nid = 0x07; |
| 19358 | if (pin_found) |
| 19359 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19360 | |
| 19361 | if (nid != spec->cur_adc) |
| 19362 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19363 | spec->cur_adc = nid; |
| 19364 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19365 | spec->cur_adc_format); |
| 19366 | } |
| 19367 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19368 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19369 | struct hda_codec *codec, |
| 19370 | unsigned int stream_tag, |
| 19371 | unsigned int format, |
| 19372 | struct snd_pcm_substream *substream) |
| 19373 | { |
| 19374 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19375 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19376 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19377 | spec->cur_adc_stream_tag = stream_tag; |
| 19378 | spec->cur_adc_format = format; |
| 19379 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19380 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19381 | return 0; |
| 19382 | } |
| 19383 | |
| 19384 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19385 | struct hda_codec *codec, |
| 19386 | struct snd_pcm_substream *substream) |
| 19387 | { |
| 19388 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19389 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19390 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19391 | return 0; |
| 19392 | } |
| 19393 | |
| 19394 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19395 | .substreams = 1, /* can be overridden */ |
| 19396 | .channels_min = 2, |
| 19397 | .channels_max = 2, |
| 19398 | /* NID is set in alc_build_pcms */ |
| 19399 | .ops = { |
| 19400 | .prepare = alc680_capture_pcm_prepare, |
| 19401 | .cleanup = alc680_capture_pcm_cleanup |
| 19402 | }, |
| 19403 | }; |
| 19404 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19405 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19406 | /* output mixer control */ |
| 19407 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19408 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19409 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19410 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19411 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19412 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19413 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19414 | { } |
| 19415 | }; |
| 19416 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19417 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19418 | .ops = &snd_hda_bind_vol, |
| 19419 | .values = { |
| 19420 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19421 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19422 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19423 | 0 |
| 19424 | }, |
| 19425 | }; |
| 19426 | |
| 19427 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19428 | .ops = &snd_hda_bind_sw, |
| 19429 | .values = { |
| 19430 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19431 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19432 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19433 | 0 |
| 19434 | }, |
| 19435 | }; |
| 19436 | |
| 19437 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19438 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19439 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19440 | { } /* end */ |
| 19441 | }; |
| 19442 | |
| 19443 | /* |
| 19444 | * generic initialization of ADC, input mixers and output mixers |
| 19445 | */ |
| 19446 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19447 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19448 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19449 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19450 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19451 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19452 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19453 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19454 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19455 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19456 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19457 | |
| 19458 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19459 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19460 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19461 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19462 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19463 | |
| 19464 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19465 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19466 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19467 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19468 | { } |
| 19469 | }; |
| 19470 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19471 | /* toggle speaker-output according to the hp-jack state */ |
| 19472 | static void alc680_base_setup(struct hda_codec *codec) |
| 19473 | { |
| 19474 | struct alc_spec *spec = codec->spec; |
| 19475 | |
| 19476 | spec->autocfg.hp_pins[0] = 0x16; |
| 19477 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19478 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19479 | spec->autocfg.num_inputs = 2; |
| 19480 | spec->autocfg.inputs[0].pin = 0x18; |
| 19481 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19482 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19483 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19484 | } |
| 19485 | |
| 19486 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19487 | unsigned int res) |
| 19488 | { |
| 19489 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19490 | alc_automute_amp(codec); |
| 19491 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19492 | alc680_rec_autoswitch(codec); |
| 19493 | } |
| 19494 | |
| 19495 | static void alc680_inithook(struct hda_codec *codec) |
| 19496 | { |
| 19497 | alc_automute_amp(codec); |
| 19498 | alc680_rec_autoswitch(codec); |
| 19499 | } |
| 19500 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19501 | /* create input playback/capture controls for the given pin */ |
| 19502 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19503 | const char *ctlname, int idx) |
| 19504 | { |
| 19505 | hda_nid_t dac; |
| 19506 | int err; |
| 19507 | |
| 19508 | switch (nid) { |
| 19509 | case 0x14: |
| 19510 | dac = 0x02; |
| 19511 | break; |
| 19512 | case 0x15: |
| 19513 | dac = 0x03; |
| 19514 | break; |
| 19515 | case 0x16: |
| 19516 | dac = 0x04; |
| 19517 | break; |
| 19518 | default: |
| 19519 | return 0; |
| 19520 | } |
| 19521 | if (spec->multiout.dac_nids[0] != dac && |
| 19522 | spec->multiout.dac_nids[1] != dac) { |
| 19523 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19524 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19525 | HDA_OUTPUT)); |
| 19526 | if (err < 0) |
| 19527 | return err; |
| 19528 | |
| 19529 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19530 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19531 | |
| 19532 | if (err < 0) |
| 19533 | return err; |
| 19534 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19535 | } |
| 19536 | |
| 19537 | return 0; |
| 19538 | } |
| 19539 | |
| 19540 | /* add playback controls from the parsed DAC table */ |
| 19541 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19542 | const struct auto_pin_cfg *cfg) |
| 19543 | { |
| 19544 | hda_nid_t nid; |
| 19545 | int err; |
| 19546 | |
| 19547 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19548 | |
| 19549 | nid = cfg->line_out_pins[0]; |
| 19550 | if (nid) { |
| 19551 | const char *name; |
| 19552 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19553 | name = "Speaker"; |
| 19554 | else |
| 19555 | name = "Front"; |
| 19556 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19557 | if (err < 0) |
| 19558 | return err; |
| 19559 | } |
| 19560 | |
| 19561 | nid = cfg->speaker_pins[0]; |
| 19562 | if (nid) { |
| 19563 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19564 | if (err < 0) |
| 19565 | return err; |
| 19566 | } |
| 19567 | nid = cfg->hp_pins[0]; |
| 19568 | if (nid) { |
| 19569 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19570 | if (err < 0) |
| 19571 | return err; |
| 19572 | } |
| 19573 | |
| 19574 | return 0; |
| 19575 | } |
| 19576 | |
| 19577 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19578 | hda_nid_t nid, int pin_type) |
| 19579 | { |
| 19580 | alc_set_pin_output(codec, nid, pin_type); |
| 19581 | } |
| 19582 | |
| 19583 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19584 | { |
| 19585 | struct alc_spec *spec = codec->spec; |
| 19586 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19587 | if (nid) { |
| 19588 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19589 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19590 | } |
| 19591 | } |
| 19592 | |
| 19593 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19594 | { |
| 19595 | struct alc_spec *spec = codec->spec; |
| 19596 | hda_nid_t pin; |
| 19597 | |
| 19598 | pin = spec->autocfg.hp_pins[0]; |
| 19599 | if (pin) |
| 19600 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19601 | pin = spec->autocfg.speaker_pins[0]; |
| 19602 | if (pin) |
| 19603 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19604 | } |
| 19605 | |
| 19606 | /* pcm configuration: identical with ALC880 */ |
| 19607 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19608 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19609 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19610 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19611 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19612 | |
| 19613 | /* |
| 19614 | * BIOS auto configuration |
| 19615 | */ |
| 19616 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19617 | { |
| 19618 | struct alc_spec *spec = codec->spec; |
| 19619 | int err; |
| 19620 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19621 | |
| 19622 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19623 | alc680_ignore); |
| 19624 | if (err < 0) |
| 19625 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19626 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19627 | if (!spec->autocfg.line_outs) { |
| 19628 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19629 | spec->multiout.max_channels = 2; |
| 19630 | spec->no_analog = 1; |
| 19631 | goto dig_only; |
| 19632 | } |
| 19633 | return 0; /* can't find valid BIOS pin config */ |
| 19634 | } |
| 19635 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19636 | if (err < 0) |
| 19637 | return err; |
| 19638 | |
| 19639 | spec->multiout.max_channels = 2; |
| 19640 | |
| 19641 | dig_only: |
| 19642 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19643 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19644 | if (spec->kctls.list) |
| 19645 | add_mixer(spec, spec->kctls.list); |
| 19646 | |
| 19647 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19648 | |
| 19649 | err = alc_auto_add_mic_boost(codec); |
| 19650 | if (err < 0) |
| 19651 | return err; |
| 19652 | |
| 19653 | return 1; |
| 19654 | } |
| 19655 | |
| 19656 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19657 | |
| 19658 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19659 | static void alc680_auto_init(struct hda_codec *codec) |
| 19660 | { |
| 19661 | struct alc_spec *spec = codec->spec; |
| 19662 | alc680_auto_init_multi_out(codec); |
| 19663 | alc680_auto_init_hp_out(codec); |
| 19664 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19665 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19666 | if (spec->unsol_event) |
| 19667 | alc_inithook(codec); |
| 19668 | } |
| 19669 | |
| 19670 | /* |
| 19671 | * configuration and preset |
| 19672 | */ |
| 19673 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19674 | [ALC680_BASE] = "base", |
| 19675 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19676 | }; |
| 19677 | |
| 19678 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19679 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19680 | {} |
| 19681 | }; |
| 19682 | |
| 19683 | static struct alc_config_preset alc680_presets[] = { |
| 19684 | [ALC680_BASE] = { |
| 19685 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19686 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19687 | .init_verbs = { alc680_init_verbs }, |
| 19688 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19689 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19690 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19691 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19692 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19693 | .unsol_event = alc680_unsol_event, |
| 19694 | .setup = alc680_base_setup, |
| 19695 | .init_hook = alc680_inithook, |
| 19696 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19697 | }, |
| 19698 | }; |
| 19699 | |
| 19700 | static int patch_alc680(struct hda_codec *codec) |
| 19701 | { |
| 19702 | struct alc_spec *spec; |
| 19703 | int board_config; |
| 19704 | int err; |
| 19705 | |
| 19706 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19707 | if (spec == NULL) |
| 19708 | return -ENOMEM; |
| 19709 | |
| 19710 | codec->spec = spec; |
| 19711 | |
| 19712 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19713 | alc680_models, |
| 19714 | alc680_cfg_tbl); |
| 19715 | |
| 19716 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19717 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19718 | codec->chip_name); |
| 19719 | board_config = ALC680_AUTO; |
| 19720 | } |
| 19721 | |
| 19722 | if (board_config == ALC680_AUTO) { |
| 19723 | /* automatic parse from the BIOS config */ |
| 19724 | err = alc680_parse_auto_config(codec); |
| 19725 | if (err < 0) { |
| 19726 | alc_free(codec); |
| 19727 | return err; |
| 19728 | } else if (!err) { |
| 19729 | printk(KERN_INFO |
| 19730 | "hda_codec: Cannot set up configuration " |
| 19731 | "from BIOS. Using base mode...\n"); |
| 19732 | board_config = ALC680_BASE; |
| 19733 | } |
| 19734 | } |
| 19735 | |
| 19736 | if (board_config != ALC680_AUTO) |
| 19737 | setup_preset(codec, &alc680_presets[board_config]); |
| 19738 | |
| 19739 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19740 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19741 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19742 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19743 | |
| 19744 | if (!spec->adc_nids) { |
| 19745 | spec->adc_nids = alc680_adc_nids; |
| 19746 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19747 | } |
| 19748 | |
| 19749 | if (!spec->cap_mixer) |
| 19750 | set_capture_mixer(codec); |
| 19751 | |
| 19752 | spec->vmaster_nid = 0x02; |
| 19753 | |
| 19754 | codec->patch_ops = alc_patch_ops; |
| 19755 | if (board_config == ALC680_AUTO) |
| 19756 | spec->init_hook = alc680_auto_init; |
| 19757 | |
| 19758 | return 0; |
| 19759 | } |
| 19760 | |
| 19761 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19762 | * patch entries |
| 19763 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19764 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19765 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19766 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19767 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19768 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19769 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19770 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19771 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19772 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19773 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19774 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19775 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19776 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19777 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19778 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19779 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19780 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19781 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19782 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19783 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19784 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19785 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19786 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19787 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19788 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19789 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19790 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19791 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19792 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19793 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19794 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19795 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19796 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19797 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19798 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19799 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19800 | {} /* terminator */ |
| 19801 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19802 | |
| 19803 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19804 | |
| 19805 | MODULE_LICENSE("GPL"); |
| 19806 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19807 | |
| 19808 | static struct hda_codec_preset_list realtek_list = { |
| 19809 | .preset = snd_hda_preset_realtek, |
| 19810 | .owner = THIS_MODULE, |
| 19811 | }; |
| 19812 | |
| 19813 | static int __init patch_realtek_init(void) |
| 19814 | { |
| 19815 | return snd_hda_add_codec_preset(&realtek_list); |
| 19816 | } |
| 19817 | |
| 19818 | static void __exit patch_realtek_exit(void) |
| 19819 | { |
| 19820 | snd_hda_delete_codec_preset(&realtek_list); |
| 19821 | } |
| 19822 | |
| 19823 | module_init(patch_realtek_init) |
| 19824 | module_exit(patch_realtek_exit) |