Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 234 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 235 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 236 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 238 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 240 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 241 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 242 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 243 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 244 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 245 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 246 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 247 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 248 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 249 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 250 | ALC889A_INTEL, |
| 251 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 252 | ALC888_ASUS_M90V, |
| 253 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 254 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 255 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 256 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 257 | ALC882_AUTO, |
| 258 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 259 | }; |
| 260 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 261 | /* ALC680 models */ |
| 262 | enum { |
| 263 | ALC680_BASE, |
| 264 | ALC680_AUTO, |
| 265 | ALC680_MODEL_LAST, |
| 266 | }; |
| 267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 268 | /* for GPIO Poll */ |
| 269 | #define GPIO_MASK 0x03 |
| 270 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 271 | /* extra amp-initialization sequence types */ |
| 272 | enum { |
| 273 | ALC_INIT_NONE, |
| 274 | ALC_INIT_DEFAULT, |
| 275 | ALC_INIT_GPIO1, |
| 276 | ALC_INIT_GPIO2, |
| 277 | ALC_INIT_GPIO3, |
| 278 | }; |
| 279 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 280 | struct alc_mic_route { |
| 281 | hda_nid_t pin; |
| 282 | unsigned char mux_idx; |
| 283 | unsigned char amix_idx; |
| 284 | }; |
| 285 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 286 | struct alc_jack { |
| 287 | hda_nid_t nid; |
| 288 | int type; |
| 289 | struct snd_jack *jack; |
| 290 | }; |
| 291 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 292 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 293 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 294 | struct alc_customize_define { |
| 295 | unsigned int sku_cfg; |
| 296 | unsigned char port_connectivity; |
| 297 | unsigned char check_sum; |
| 298 | unsigned char customization; |
| 299 | unsigned char external_amp; |
| 300 | unsigned int enable_pcbeep:1; |
| 301 | unsigned int platform_type:1; |
| 302 | unsigned int swap:1; |
| 303 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 304 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 305 | }; |
| 306 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | struct alc_spec { |
| 308 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 309 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 311 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 312 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 314 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 315 | * don't forget NULL |
| 316 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 317 | */ |
| 318 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 320 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | struct hda_pcm_stream *stream_analog_playback; |
| 322 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 323 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 324 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 326 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | struct hda_pcm_stream *stream_digital_playback; |
| 328 | struct hda_pcm_stream *stream_digital_capture; |
| 329 | |
| 330 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 331 | struct hda_multi_out multiout; /* playback set-up |
| 332 | * max_channels, dacs must be set |
| 333 | * dig_out_nid and hp_nid are optional |
| 334 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 335 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 336 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 337 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | |
| 339 | /* capture */ |
| 340 | unsigned int num_adc_nids; |
| 341 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 342 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 343 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 345 | /* capture setup for dynamic dual-adc switch */ |
| 346 | unsigned int cur_adc_idx; |
| 347 | hda_nid_t cur_adc; |
| 348 | unsigned int cur_adc_stream_tag; |
| 349 | unsigned int cur_adc_format; |
| 350 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 352 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | const struct hda_input_mux *input_mux; |
| 354 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 355 | struct alc_mic_route ext_mic; |
| 356 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | |
| 358 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 359 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 361 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 362 | int const_channel_count; |
| 363 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | |
| 365 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 366 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 367 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 368 | /* jack detection */ |
| 369 | struct snd_array jacks; |
| 370 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 371 | /* dynamic controls, init_verbs and input_mux */ |
| 372 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 373 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 374 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 375 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 376 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 377 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 378 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 379 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 380 | /* hooks */ |
| 381 | void (*init_hook)(struct hda_codec *codec); |
| 382 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 383 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 384 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 385 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 386 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 387 | /* for pin sensing */ |
| 388 | unsigned int sense_updated: 1; |
| 389 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 390 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 391 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 392 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 393 | /* other flags */ |
| 394 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 395 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 396 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 397 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 398 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 399 | /* for virtual master */ |
| 400 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 401 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 402 | struct hda_loopback_check loopback; |
| 403 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 404 | |
| 405 | /* for PLL fix */ |
| 406 | hda_nid_t pll_nid; |
| 407 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 408 | }; |
| 409 | |
| 410 | /* |
| 411 | * configuration template - to be copied to the spec instance |
| 412 | */ |
| 413 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 414 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 415 | * with spec |
| 416 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 417 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 418 | const struct hda_verb *init_verbs[5]; |
| 419 | unsigned int num_dacs; |
| 420 | hda_nid_t *dac_nids; |
| 421 | hda_nid_t dig_out_nid; /* optional */ |
| 422 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 423 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 424 | unsigned int num_adc_nids; |
| 425 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 426 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 427 | hda_nid_t dig_in_nid; |
| 428 | unsigned int num_channel_mode; |
| 429 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 430 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 431 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 432 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 433 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 434 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 435 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 436 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 437 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 438 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 439 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 440 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | }; |
| 442 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | |
| 444 | /* |
| 445 | * input MUX handling |
| 446 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 447 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 448 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | { |
| 450 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 451 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 452 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 453 | if (mux_idx >= spec->num_mux_defs) |
| 454 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 455 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 456 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 457 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | } |
| 459 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 460 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 461 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | { |
| 463 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 464 | struct alc_spec *spec = codec->spec; |
| 465 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 466 | |
| 467 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 468 | return 0; |
| 469 | } |
| 470 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 471 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 472 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | { |
| 474 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 475 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 476 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 478 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 479 | hda_nid_t nid = spec->capsrc_nids ? |
| 480 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 481 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 483 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 484 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 485 | if (!imux->num_items && mux_idx > 0) |
| 486 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 487 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 488 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 489 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 490 | /* Matrix-mixer style (e.g. ALC882) */ |
| 491 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 492 | unsigned int i, idx; |
| 493 | |
| 494 | idx = ucontrol->value.enumerated.item[0]; |
| 495 | if (idx >= imux->num_items) |
| 496 | idx = imux->num_items - 1; |
| 497 | if (*cur_val == idx) |
| 498 | return 0; |
| 499 | for (i = 0; i < imux->num_items; i++) { |
| 500 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 501 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 502 | imux->items[i].index, |
| 503 | HDA_AMP_MUTE, v); |
| 504 | } |
| 505 | *cur_val = idx; |
| 506 | return 1; |
| 507 | } else { |
| 508 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 509 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 510 | &spec->cur_mux[adc_idx]); |
| 511 | } |
| 512 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 513 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | /* |
| 515 | * channel mode setting |
| 516 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 517 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 518 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | { |
| 520 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 521 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 522 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 523 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | } |
| 525 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 526 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 527 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 528 | { |
| 529 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 530 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 531 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 532 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 533 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | } |
| 535 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 536 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 537 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | { |
| 539 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 540 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 541 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 542 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 543 | &spec->ext_channel_count); |
| 544 | if (err >= 0 && !spec->const_channel_count) { |
| 545 | spec->multiout.max_channels = spec->ext_channel_count; |
| 546 | if (spec->need_dac_fix) |
| 547 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 548 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 549 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | } |
| 551 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 553 | * 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] | 554 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 555 | * being part of a format specifier. Maximum allowed length of a value is |
| 556 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 557 | * |
| 558 | * Note: some retasking pin complexes seem to ignore requests for input |
| 559 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 560 | * are requested. Therefore order this list so that this behaviour will not |
| 561 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 562 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 563 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 564 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 565 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 566 | "Mic 50pc bias", "Mic 80pc bias", |
| 567 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 568 | }; |
| 569 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 570 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 571 | }; |
| 572 | /* 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] | 573 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 574 | * addition, "input" pins may or may not process the mic bias option |
| 575 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 576 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 577 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 578 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 579 | #define ALC_PIN_DIR_IN 0x00 |
| 580 | #define ALC_PIN_DIR_OUT 0x01 |
| 581 | #define ALC_PIN_DIR_INOUT 0x02 |
| 582 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 583 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 584 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 585 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 586 | * For each direction the minimum and maximum values are given. |
| 587 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 588 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 589 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 590 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 591 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 592 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 593 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 594 | }; |
| 595 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 596 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 597 | #define alc_pin_mode_n_items(_dir) \ |
| 598 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 599 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 600 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 601 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 602 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 603 | unsigned int item_num = uinfo->value.enumerated.item; |
| 604 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 605 | |
| 606 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 607 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 608 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 609 | |
| 610 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 611 | item_num = alc_pin_mode_min(dir); |
| 612 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 613 | return 0; |
| 614 | } |
| 615 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 616 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 617 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 618 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 619 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 620 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 621 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 622 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 623 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 624 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 625 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 626 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 627 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 628 | /* Find enumerated value for current pinctl setting */ |
| 629 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 630 | 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] | 631 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 632 | *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] | 633 | return 0; |
| 634 | } |
| 635 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 636 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 637 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 638 | { |
| 639 | signed int change; |
| 640 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 641 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 642 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 643 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 644 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 645 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 646 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 647 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 648 | 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] | 649 | val = alc_pin_mode_min(dir); |
| 650 | |
| 651 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 652 | if (change) { |
| 653 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 654 | snd_hda_codec_write_cache(codec, nid, 0, |
| 655 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 656 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 657 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 658 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 659 | * for the requested pin mode. Enum values of 2 or less are |
| 660 | * input modes. |
| 661 | * |
| 662 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 663 | * reduces noise slightly (particularly on input) so we'll |
| 664 | * do it. However, having both input and output buffers |
| 665 | * enabled simultaneously doesn't seem to be problematic if |
| 666 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 667 | */ |
| 668 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 669 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 670 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 671 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 672 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 673 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 674 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 675 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 676 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 677 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 678 | } |
| 679 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 680 | return change; |
| 681 | } |
| 682 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 683 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 684 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 685 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 686 | .info = alc_pin_mode_info, \ |
| 687 | .get = alc_pin_mode_get, \ |
| 688 | .put = alc_pin_mode_put, \ |
| 689 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 690 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 691 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 692 | * together using a mask with more than one bit set. This control is |
| 693 | * currently used only by the ALC260 test model. At this stage they are not |
| 694 | * needed for any "production" models. |
| 695 | */ |
| 696 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 697 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 698 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 699 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 700 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 701 | { |
| 702 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 703 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 704 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 705 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 706 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 707 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 708 | |
| 709 | *valp = (val & mask) != 0; |
| 710 | return 0; |
| 711 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 712 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 713 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 714 | { |
| 715 | signed int change; |
| 716 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 717 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 718 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 719 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 720 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 721 | AC_VERB_GET_GPIO_DATA, |
| 722 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 723 | |
| 724 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 725 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 726 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 727 | gpio_data &= ~mask; |
| 728 | else |
| 729 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 730 | snd_hda_codec_write_cache(codec, nid, 0, |
| 731 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 732 | |
| 733 | return change; |
| 734 | } |
| 735 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 736 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 737 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 738 | .info = alc_gpio_data_info, \ |
| 739 | .get = alc_gpio_data_get, \ |
| 740 | .put = alc_gpio_data_put, \ |
| 741 | .private_value = nid | (mask<<16) } |
| 742 | #endif /* CONFIG_SND_DEBUG */ |
| 743 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 744 | /* A switch control to allow the enabling of the digital IO pins on the |
| 745 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 746 | * to provide something in the test model allowing digital outputs to be |
| 747 | * identified if present. If models are found which can utilise these |
| 748 | * outputs a more complete mixer control can be devised for those models if |
| 749 | * necessary. |
| 750 | */ |
| 751 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 752 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 753 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 754 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 755 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 756 | { |
| 757 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 758 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 759 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 760 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 761 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 762 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 763 | |
| 764 | *valp = (val & mask) != 0; |
| 765 | return 0; |
| 766 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 767 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 768 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 769 | { |
| 770 | signed int change; |
| 771 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 772 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 773 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 774 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 775 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 776 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 777 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 778 | |
| 779 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 780 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 781 | if (val==0) |
| 782 | ctrl_data &= ~mask; |
| 783 | else |
| 784 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 785 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 786 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 787 | |
| 788 | return change; |
| 789 | } |
| 790 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 791 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 792 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 793 | .info = alc_spdif_ctrl_info, \ |
| 794 | .get = alc_spdif_ctrl_get, \ |
| 795 | .put = alc_spdif_ctrl_put, \ |
| 796 | .private_value = nid | (mask<<16) } |
| 797 | #endif /* CONFIG_SND_DEBUG */ |
| 798 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 799 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 800 | * Again, this is only used in the ALC26x test models to help identify when |
| 801 | * the EAPD line must be asserted for features to work. |
| 802 | */ |
| 803 | #ifdef CONFIG_SND_DEBUG |
| 804 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 805 | |
| 806 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 807 | struct snd_ctl_elem_value *ucontrol) |
| 808 | { |
| 809 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 810 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 811 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 812 | long *valp = ucontrol->value.integer.value; |
| 813 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 814 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 815 | |
| 816 | *valp = (val & mask) != 0; |
| 817 | return 0; |
| 818 | } |
| 819 | |
| 820 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 821 | struct snd_ctl_elem_value *ucontrol) |
| 822 | { |
| 823 | int change; |
| 824 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 825 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 826 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 827 | long val = *ucontrol->value.integer.value; |
| 828 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 829 | AC_VERB_GET_EAPD_BTLENABLE, |
| 830 | 0x00); |
| 831 | |
| 832 | /* Set/unset the masked control bit(s) as needed */ |
| 833 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 834 | if (!val) |
| 835 | ctrl_data &= ~mask; |
| 836 | else |
| 837 | ctrl_data |= mask; |
| 838 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 839 | ctrl_data); |
| 840 | |
| 841 | return change; |
| 842 | } |
| 843 | |
| 844 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 845 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 846 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 847 | .info = alc_eapd_ctrl_info, \ |
| 848 | .get = alc_eapd_ctrl_get, \ |
| 849 | .put = alc_eapd_ctrl_put, \ |
| 850 | .private_value = nid | (mask<<16) } |
| 851 | #endif /* CONFIG_SND_DEBUG */ |
| 852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 853 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 854 | * set up the input pin config (depending on the given auto-pin type) |
| 855 | */ |
| 856 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 857 | int auto_pin_type) |
| 858 | { |
| 859 | unsigned int val = PIN_IN; |
| 860 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 861 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 862 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 863 | unsigned int oldval; |
| 864 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 865 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 866 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 867 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 868 | /* if the default pin setup is vref50, we give it priority */ |
| 869 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 870 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 871 | else if (pincap & AC_PINCAP_VREF_50) |
| 872 | val = PIN_VREF50; |
| 873 | else if (pincap & AC_PINCAP_VREF_100) |
| 874 | val = PIN_VREF100; |
| 875 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 876 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 877 | } |
| 878 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 879 | } |
| 880 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 881 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 882 | { |
| 883 | struct alc_spec *spec = codec->spec; |
| 884 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 885 | |
| 886 | if (!cfg->line_outs) { |
| 887 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 888 | cfg->line_out_pins[cfg->line_outs]) |
| 889 | cfg->line_outs++; |
| 890 | } |
| 891 | if (!cfg->speaker_outs) { |
| 892 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 893 | cfg->speaker_pins[cfg->speaker_outs]) |
| 894 | cfg->speaker_outs++; |
| 895 | } |
| 896 | if (!cfg->hp_outs) { |
| 897 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 898 | cfg->hp_pins[cfg->hp_outs]) |
| 899 | cfg->hp_outs++; |
| 900 | } |
| 901 | } |
| 902 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 903 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 904 | */ |
| 905 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 906 | { |
| 907 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 908 | return; |
| 909 | spec->mixers[spec->num_mixers++] = mix; |
| 910 | } |
| 911 | |
| 912 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 913 | { |
| 914 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 915 | return; |
| 916 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 917 | } |
| 918 | |
| 919 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 920 | * set up from the preset table |
| 921 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 922 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 923 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 924 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 925 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 926 | int i; |
| 927 | |
| 928 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 929 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 930 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 931 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 932 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 933 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 934 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 935 | spec->channel_mode = preset->channel_mode; |
| 936 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 937 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 938 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 939 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 940 | if (preset->const_channel_count) |
| 941 | spec->multiout.max_channels = preset->const_channel_count; |
| 942 | else |
| 943 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 944 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 945 | |
| 946 | spec->multiout.num_dacs = preset->num_dacs; |
| 947 | spec->multiout.dac_nids = preset->dac_nids; |
| 948 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 949 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 950 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 951 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 952 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 953 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 954 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 955 | spec->input_mux = preset->input_mux; |
| 956 | |
| 957 | spec->num_adc_nids = preset->num_adc_nids; |
| 958 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 959 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 960 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 961 | |
| 962 | spec->unsol_event = preset->unsol_event; |
| 963 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 964 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 965 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 966 | spec->loopback.amplist = preset->loopbacks; |
| 967 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 968 | |
| 969 | if (preset->setup) |
| 970 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 971 | |
| 972 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 973 | } |
| 974 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 975 | /* Enable GPIO mask and set output */ |
| 976 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 977 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 978 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 979 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 980 | { } |
| 981 | }; |
| 982 | |
| 983 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 984 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 985 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 986 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 987 | { } |
| 988 | }; |
| 989 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 990 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 991 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 992 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 993 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 994 | { } |
| 995 | }; |
| 996 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 997 | /* |
| 998 | * Fix hardware PLL issue |
| 999 | * On some codecs, the analog PLL gating control must be off while |
| 1000 | * the default value is 1. |
| 1001 | */ |
| 1002 | static void alc_fix_pll(struct hda_codec *codec) |
| 1003 | { |
| 1004 | struct alc_spec *spec = codec->spec; |
| 1005 | unsigned int val; |
| 1006 | |
| 1007 | if (!spec->pll_nid) |
| 1008 | return; |
| 1009 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1010 | spec->pll_coef_idx); |
| 1011 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1012 | AC_VERB_GET_PROC_COEF, 0); |
| 1013 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1014 | spec->pll_coef_idx); |
| 1015 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1016 | val & ~(1 << spec->pll_coef_bit)); |
| 1017 | } |
| 1018 | |
| 1019 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1020 | unsigned int coef_idx, unsigned int coef_bit) |
| 1021 | { |
| 1022 | struct alc_spec *spec = codec->spec; |
| 1023 | spec->pll_nid = nid; |
| 1024 | spec->pll_coef_idx = coef_idx; |
| 1025 | spec->pll_coef_bit = coef_bit; |
| 1026 | alc_fix_pll(codec); |
| 1027 | } |
| 1028 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1029 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
| 1030 | static void alc_free_jack_priv(struct snd_jack *jack) |
| 1031 | { |
| 1032 | struct alc_jack *jacks = jack->private_data; |
| 1033 | jacks->nid = 0; |
| 1034 | jacks->jack = NULL; |
| 1035 | } |
| 1036 | |
| 1037 | static int alc_add_jack(struct hda_codec *codec, |
| 1038 | hda_nid_t nid, int type) |
| 1039 | { |
| 1040 | struct alc_spec *spec; |
| 1041 | struct alc_jack *jack; |
| 1042 | const char *name; |
| 1043 | int err; |
| 1044 | |
| 1045 | spec = codec->spec; |
| 1046 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 1047 | jack = snd_array_new(&spec->jacks); |
| 1048 | if (!jack) |
| 1049 | return -ENOMEM; |
| 1050 | |
| 1051 | jack->nid = nid; |
| 1052 | jack->type = type; |
| 1053 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
| 1054 | |
| 1055 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); |
| 1056 | if (err < 0) |
| 1057 | return err; |
| 1058 | jack->jack->private_data = jack; |
| 1059 | jack->jack->private_free = alc_free_jack_priv; |
| 1060 | return 0; |
| 1061 | } |
| 1062 | |
| 1063 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1064 | { |
| 1065 | struct alc_spec *spec = codec->spec; |
| 1066 | struct alc_jack *jacks = spec->jacks.list; |
| 1067 | |
| 1068 | if (jacks) { |
| 1069 | int i; |
| 1070 | for (i = 0; i < spec->jacks.used; i++) { |
| 1071 | if (jacks->nid == nid) { |
| 1072 | unsigned int present; |
| 1073 | present = snd_hda_jack_detect(codec, nid); |
| 1074 | |
| 1075 | present = (present) ? jacks->type : 0; |
| 1076 | |
| 1077 | snd_jack_report(jacks->jack, present); |
| 1078 | } |
| 1079 | jacks++; |
| 1080 | } |
| 1081 | } |
| 1082 | } |
| 1083 | |
| 1084 | static int alc_init_jacks(struct hda_codec *codec) |
| 1085 | { |
| 1086 | struct alc_spec *spec = codec->spec; |
| 1087 | int err; |
| 1088 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1089 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1090 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1091 | if (hp_nid) { |
| 1092 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); |
| 1093 | if (err < 0) |
| 1094 | return err; |
| 1095 | alc_report_jack(codec, hp_nid); |
| 1096 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1097 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1098 | if (mic_nid) { |
| 1099 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); |
| 1100 | if (err < 0) |
| 1101 | return err; |
| 1102 | alc_report_jack(codec, mic_nid); |
| 1103 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1104 | |
| 1105 | return 0; |
| 1106 | } |
| 1107 | #else |
| 1108 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1109 | { |
| 1110 | } |
| 1111 | |
| 1112 | static inline int alc_init_jacks(struct hda_codec *codec) |
| 1113 | { |
| 1114 | return 0; |
| 1115 | } |
| 1116 | #endif |
| 1117 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1118 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1119 | { |
| 1120 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1121 | unsigned int mute; |
| 1122 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1123 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1124 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1125 | spec->jack_present = 0; |
| 1126 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1127 | nid = spec->autocfg.hp_pins[i]; |
| 1128 | if (!nid) |
| 1129 | break; |
| 1130 | if (snd_hda_jack_detect(codec, nid)) { |
| 1131 | spec->jack_present = 1; |
| 1132 | break; |
| 1133 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1134 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1135 | } |
| 1136 | |
| 1137 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1138 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1139 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1140 | nid = spec->autocfg.speaker_pins[i]; |
| 1141 | if (!nid) |
| 1142 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1143 | if (pinctl) { |
| 1144 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1145 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1146 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1147 | } else { |
| 1148 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1149 | HDA_AMP_MUTE, mute); |
| 1150 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1151 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1152 | } |
| 1153 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1154 | static void alc_automute_pin(struct hda_codec *codec) |
| 1155 | { |
| 1156 | alc_automute_speaker(codec, 1); |
| 1157 | } |
| 1158 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1159 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1160 | hda_nid_t nid) |
| 1161 | { |
| 1162 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1163 | int i, nums; |
| 1164 | |
| 1165 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1166 | for (i = 0; i < nums; i++) |
| 1167 | if (conn[i] == nid) |
| 1168 | return i; |
| 1169 | return -1; |
| 1170 | } |
| 1171 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1172 | /* switch the current ADC according to the jack state */ |
| 1173 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1174 | { |
| 1175 | struct alc_spec *spec = codec->spec; |
| 1176 | unsigned int present; |
| 1177 | hda_nid_t new_adc; |
| 1178 | |
| 1179 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1180 | if (present) |
| 1181 | spec->cur_adc_idx = 1; |
| 1182 | else |
| 1183 | spec->cur_adc_idx = 0; |
| 1184 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1185 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1186 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1187 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1188 | spec->cur_adc = new_adc; |
| 1189 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1190 | spec->cur_adc_stream_tag, 0, |
| 1191 | spec->cur_adc_format); |
| 1192 | } |
| 1193 | } |
| 1194 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1195 | static void alc_mic_automute(struct hda_codec *codec) |
| 1196 | { |
| 1197 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1198 | struct alc_mic_route *dead, *alive; |
| 1199 | unsigned int present, type; |
| 1200 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1201 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1202 | if (!spec->auto_mic) |
| 1203 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1204 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1205 | return; |
| 1206 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1207 | return; |
| 1208 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1209 | if (spec->dual_adc_switch) { |
| 1210 | alc_dual_mic_adc_auto_switch(codec); |
| 1211 | return; |
| 1212 | } |
| 1213 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1214 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1215 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1216 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1217 | if (present) { |
| 1218 | alive = &spec->ext_mic; |
| 1219 | dead = &spec->int_mic; |
| 1220 | } else { |
| 1221 | alive = &spec->int_mic; |
| 1222 | dead = &spec->ext_mic; |
| 1223 | } |
| 1224 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1225 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1226 | if (type == AC_WID_AUD_MIX) { |
| 1227 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1228 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1229 | alive->mux_idx, |
| 1230 | HDA_AMP_MUTE, 0); |
| 1231 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1232 | dead->mux_idx, |
| 1233 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1234 | } else { |
| 1235 | /* MUX style (e.g. ALC880) */ |
| 1236 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1237 | AC_VERB_SET_CONNECT_SEL, |
| 1238 | alive->mux_idx); |
| 1239 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1240 | alc_report_jack(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1241 | |
| 1242 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1243 | } |
| 1244 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1245 | /* unsolicited event for HP jack sensing */ |
| 1246 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1247 | { |
| 1248 | if (codec->vendor_id == 0x10ec0880) |
| 1249 | res >>= 28; |
| 1250 | else |
| 1251 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1252 | switch (res) { |
| 1253 | case ALC880_HP_EVENT: |
| 1254 | alc_automute_pin(codec); |
| 1255 | break; |
| 1256 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1257 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1258 | break; |
| 1259 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1260 | } |
| 1261 | |
| 1262 | static void alc_inithook(struct hda_codec *codec) |
| 1263 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1264 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1265 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1266 | } |
| 1267 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1268 | /* additional initialization for ALC888 variants */ |
| 1269 | static void alc888_coef_init(struct hda_codec *codec) |
| 1270 | { |
| 1271 | unsigned int tmp; |
| 1272 | |
| 1273 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1274 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1275 | 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] | 1276 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1277 | /* alc888S-VC */ |
| 1278 | snd_hda_codec_read(codec, 0x20, 0, |
| 1279 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1280 | else |
| 1281 | /* alc888-VB */ |
| 1282 | snd_hda_codec_read(codec, 0x20, 0, |
| 1283 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1284 | } |
| 1285 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1286 | static void alc889_coef_init(struct hda_codec *codec) |
| 1287 | { |
| 1288 | unsigned int tmp; |
| 1289 | |
| 1290 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1291 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1292 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1293 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1294 | } |
| 1295 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1296 | /* turn on/off EAPD control (only if available) */ |
| 1297 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1298 | { |
| 1299 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1300 | return; |
| 1301 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1302 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1303 | on ? 2 : 0); |
| 1304 | } |
| 1305 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1306 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1307 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1308 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1309 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1310 | switch (type) { |
| 1311 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1312 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1313 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1314 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1315 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1316 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1317 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1318 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1319 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1320 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1321 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1322 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1323 | set_eapd(codec, 0x0f, 1); |
| 1324 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1325 | break; |
| 1326 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1327 | case 0x10ec0267: |
| 1328 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1329 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1330 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1331 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1332 | case 0x10ec0660: |
| 1333 | case 0x10ec0662: |
| 1334 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1335 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1336 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1337 | set_eapd(codec, 0x14, 1); |
| 1338 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1339 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1340 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1341 | switch (codec->vendor_id) { |
| 1342 | case 0x10ec0260: |
| 1343 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1344 | AC_VERB_SET_COEF_INDEX, 7); |
| 1345 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1346 | AC_VERB_GET_PROC_COEF, 0); |
| 1347 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1348 | AC_VERB_SET_COEF_INDEX, 7); |
| 1349 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1350 | AC_VERB_SET_PROC_COEF, |
| 1351 | tmp | 0x2010); |
| 1352 | break; |
| 1353 | case 0x10ec0262: |
| 1354 | case 0x10ec0880: |
| 1355 | case 0x10ec0882: |
| 1356 | case 0x10ec0883: |
| 1357 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1358 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1359 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1360 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1361 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1362 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1363 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1364 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1365 | #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] | 1366 | case 0x10ec0267: |
| 1367 | case 0x10ec0268: |
| 1368 | snd_hda_codec_write(codec, 0x20, 0, |
| 1369 | AC_VERB_SET_COEF_INDEX, 7); |
| 1370 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1371 | AC_VERB_GET_PROC_COEF, 0); |
| 1372 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1373 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1374 | snd_hda_codec_write(codec, 0x20, 0, |
| 1375 | AC_VERB_SET_PROC_COEF, |
| 1376 | tmp | 0x3000); |
| 1377 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1378 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1379 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1380 | break; |
| 1381 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1382 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1383 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1384 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1385 | { |
| 1386 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1387 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1388 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1389 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1390 | if (!cfg->hp_pins[0]) { |
| 1391 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1392 | return; |
| 1393 | } |
| 1394 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1395 | if (!cfg->speaker_pins[0]) { |
| 1396 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1397 | return; |
| 1398 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1399 | sizeof(cfg->speaker_pins)); |
| 1400 | cfg->speaker_outs = cfg->line_outs; |
| 1401 | } |
| 1402 | |
| 1403 | if (!cfg->hp_pins[0]) { |
| 1404 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1405 | sizeof(cfg->hp_pins)); |
| 1406 | cfg->hp_outs = cfg->line_outs; |
| 1407 | } |
| 1408 | |
| 1409 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1410 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1411 | cfg->hp_pins[i]); |
| 1412 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1413 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1414 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1415 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1416 | spec->unsol_event = alc_sku_unsol_event; |
| 1417 | } |
| 1418 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1419 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1420 | { |
| 1421 | struct alc_spec *spec = codec->spec; |
| 1422 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1423 | hda_nid_t fixed, ext; |
| 1424 | int i; |
| 1425 | |
| 1426 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1427 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1428 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1429 | return; |
| 1430 | |
| 1431 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1432 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1433 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1434 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1435 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1436 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1437 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1438 | if (fixed) |
| 1439 | return; /* already occupied */ |
| 1440 | fixed = nid; |
| 1441 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1442 | case INPUT_PIN_ATTR_UNUSED: |
| 1443 | return; /* invalid entry */ |
| 1444 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1445 | if (ext) |
| 1446 | return; /* already occupied */ |
| 1447 | ext = nid; |
| 1448 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1449 | } |
| 1450 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1451 | if (!ext || !fixed) |
| 1452 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1453 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1454 | return; /* no unsol support */ |
| 1455 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1456 | ext, fixed); |
| 1457 | spec->ext_mic.pin = ext; |
| 1458 | spec->int_mic.pin = fixed; |
| 1459 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1460 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1461 | spec->auto_mic = 1; |
| 1462 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1463 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1464 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1465 | spec->unsol_event = alc_sku_unsol_event; |
| 1466 | } |
| 1467 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1468 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1469 | * the driver to ignore any present sku defines. |
| 1470 | */ |
| 1471 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1472 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1473 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1474 | { |
| 1475 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1476 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1477 | struct alc_spec *spec = codec->spec; |
| 1478 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1479 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1480 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1481 | if (spec->cdefine.fixup) { |
| 1482 | ass = spec->cdefine.sku_cfg; |
| 1483 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1484 | return -1; |
| 1485 | goto do_sku; |
| 1486 | } |
| 1487 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1488 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1489 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1490 | goto do_sku; |
| 1491 | |
| 1492 | nid = 0x1d; |
| 1493 | if (codec->vendor_id == 0x10ec0260) |
| 1494 | nid = 0x17; |
| 1495 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1496 | |
| 1497 | if (!(ass & 1)) { |
| 1498 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1499 | codec->chip_name, ass); |
| 1500 | return -1; |
| 1501 | } |
| 1502 | |
| 1503 | /* check sum */ |
| 1504 | tmp = 0; |
| 1505 | for (i = 1; i < 16; i++) { |
| 1506 | if ((ass >> i) & 1) |
| 1507 | tmp++; |
| 1508 | } |
| 1509 | if (((ass >> 16) & 0xf) != tmp) |
| 1510 | return -1; |
| 1511 | |
| 1512 | spec->cdefine.port_connectivity = ass >> 30; |
| 1513 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1514 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1515 | spec->cdefine.customization = ass >> 8; |
| 1516 | do_sku: |
| 1517 | spec->cdefine.sku_cfg = ass; |
| 1518 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1519 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1520 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1521 | spec->cdefine.override = ass & 0x1; |
| 1522 | |
| 1523 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1524 | nid, spec->cdefine.sku_cfg); |
| 1525 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1526 | spec->cdefine.port_connectivity); |
| 1527 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1528 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1529 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1530 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1531 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1532 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1533 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1534 | |
| 1535 | return 0; |
| 1536 | } |
| 1537 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1538 | /* check subsystem ID and set up device-specific initialization; |
| 1539 | * return 1 if initialized, 0 if invalid SSID |
| 1540 | */ |
| 1541 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1542 | * 31 ~ 16 : Manufacture ID |
| 1543 | * 15 ~ 8 : SKU ID |
| 1544 | * 7 ~ 0 : Assembly ID |
| 1545 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1546 | */ |
| 1547 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1548 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1549 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1550 | { |
| 1551 | unsigned int ass, tmp, i; |
| 1552 | unsigned nid; |
| 1553 | struct alc_spec *spec = codec->spec; |
| 1554 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1555 | if (spec->cdefine.fixup) { |
| 1556 | ass = spec->cdefine.sku_cfg; |
| 1557 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1558 | return 0; |
| 1559 | goto do_sku; |
| 1560 | } |
| 1561 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1562 | ass = codec->subsystem_id & 0xffff; |
| 1563 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1564 | goto do_sku; |
| 1565 | |
| 1566 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1567 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1568 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1569 | * 29~21 : reserve |
| 1570 | * 20 : PCBEEP input |
| 1571 | * 19~16 : Check sum (15:1) |
| 1572 | * 15~1 : Custom |
| 1573 | * 0 : override |
| 1574 | */ |
| 1575 | nid = 0x1d; |
| 1576 | if (codec->vendor_id == 0x10ec0260) |
| 1577 | nid = 0x17; |
| 1578 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1579 | snd_printd("realtek: No valid SSID, " |
| 1580 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1581 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1582 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1583 | return 0; |
| 1584 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1585 | return 0; |
| 1586 | |
| 1587 | /* check sum */ |
| 1588 | tmp = 0; |
| 1589 | for (i = 1; i < 16; i++) { |
| 1590 | if ((ass >> i) & 1) |
| 1591 | tmp++; |
| 1592 | } |
| 1593 | if (((ass >> 16) & 0xf) != tmp) |
| 1594 | return 0; |
| 1595 | do_sku: |
| 1596 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1597 | ass & 0xffff, codec->vendor_id); |
| 1598 | /* |
| 1599 | * 0 : override |
| 1600 | * 1 : Swap Jack |
| 1601 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1602 | * 3~5 : External Amplifier control |
| 1603 | * 7~6 : Reserved |
| 1604 | */ |
| 1605 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1606 | switch (tmp) { |
| 1607 | case 1: |
| 1608 | spec->init_amp = ALC_INIT_GPIO1; |
| 1609 | break; |
| 1610 | case 3: |
| 1611 | spec->init_amp = ALC_INIT_GPIO2; |
| 1612 | break; |
| 1613 | case 7: |
| 1614 | spec->init_amp = ALC_INIT_GPIO3; |
| 1615 | break; |
| 1616 | case 5: |
| 1617 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1618 | break; |
| 1619 | } |
| 1620 | |
| 1621 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1622 | * when the external headphone out jack is plugged" |
| 1623 | */ |
| 1624 | if (!(ass & 0x8000)) |
| 1625 | return 1; |
| 1626 | /* |
| 1627 | * 10~8 : Jack location |
| 1628 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1629 | * 14~13: Resvered |
| 1630 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1631 | * when the external headphone out jack is plugged" |
| 1632 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1633 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1634 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1635 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1636 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1637 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1638 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1639 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1640 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1641 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1642 | else if (tmp == 3) |
| 1643 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1644 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1645 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1646 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1647 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1648 | return 1; |
| 1649 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1650 | } |
| 1651 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1652 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1653 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1654 | return 1; |
| 1655 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1656 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1657 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1658 | hda_nid_t porta, hda_nid_t porte, |
| 1659 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1660 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1661 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1662 | struct alc_spec *spec = codec->spec; |
| 1663 | snd_printd("realtek: " |
| 1664 | "Enable default setup for auto mode as fallback\n"); |
| 1665 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1666 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1667 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1668 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1669 | } |
| 1670 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1671 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1672 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1673 | */ |
| 1674 | |
| 1675 | struct alc_pincfg { |
| 1676 | hda_nid_t nid; |
| 1677 | u32 val; |
| 1678 | }; |
| 1679 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1680 | struct alc_fixup { |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1681 | unsigned int sku; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1682 | const struct alc_pincfg *pins; |
| 1683 | const struct hda_verb *verbs; |
| 1684 | }; |
| 1685 | |
| 1686 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1687 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1688 | const struct alc_fixup *fix, |
| 1689 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1690 | { |
| 1691 | const struct alc_pincfg *cfg; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1692 | struct alc_spec *spec; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1693 | |
| 1694 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1695 | if (!quirk) |
| 1696 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1697 | fix += quirk->value; |
| 1698 | cfg = fix->pins; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1699 | if (pre_init && fix->sku) { |
| 1700 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1701 | snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", |
| 1702 | codec->chip_name, quirk->name); |
| 1703 | #endif |
| 1704 | spec = codec->spec; |
| 1705 | spec->cdefine.sku_cfg = fix->sku; |
| 1706 | spec->cdefine.fixup = 1; |
| 1707 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1708 | if (pre_init && cfg) { |
| 1709 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1710 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1711 | codec->chip_name, quirk->name); |
| 1712 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1713 | for (; cfg->nid; cfg++) |
| 1714 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1715 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1716 | if (!pre_init && fix->verbs) { |
| 1717 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1718 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1719 | codec->chip_name, quirk->name); |
| 1720 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1721 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1722 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1723 | } |
| 1724 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1725 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1726 | unsigned int coef_idx) |
| 1727 | { |
| 1728 | unsigned int val; |
| 1729 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1730 | coef_idx); |
| 1731 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1732 | AC_VERB_GET_PROC_COEF, 0); |
| 1733 | return val; |
| 1734 | } |
| 1735 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1736 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1737 | unsigned int coef_val) |
| 1738 | { |
| 1739 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1740 | coef_idx); |
| 1741 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1742 | coef_val); |
| 1743 | } |
| 1744 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1745 | /* set right pin controls for digital I/O */ |
| 1746 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1747 | { |
| 1748 | struct alc_spec *spec = codec->spec; |
| 1749 | int i; |
| 1750 | hda_nid_t pin; |
| 1751 | |
| 1752 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1753 | pin = spec->autocfg.dig_out_pins[i]; |
| 1754 | if (pin) { |
| 1755 | snd_hda_codec_write(codec, pin, 0, |
| 1756 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1757 | PIN_OUT); |
| 1758 | } |
| 1759 | } |
| 1760 | pin = spec->autocfg.dig_in_pin; |
| 1761 | if (pin) |
| 1762 | snd_hda_codec_write(codec, pin, 0, |
| 1763 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1764 | PIN_IN); |
| 1765 | } |
| 1766 | |
| 1767 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1768 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1769 | { |
| 1770 | struct alc_spec *spec = codec->spec; |
| 1771 | int i, err; |
| 1772 | hda_nid_t dig_nid; |
| 1773 | |
| 1774 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1775 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1776 | err = snd_hda_get_connections(codec, |
| 1777 | spec->autocfg.dig_out_pins[i], |
| 1778 | &dig_nid, 1); |
| 1779 | if (err < 0) |
| 1780 | continue; |
| 1781 | if (!i) { |
| 1782 | spec->multiout.dig_out_nid = dig_nid; |
| 1783 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1784 | } else { |
| 1785 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1786 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1787 | break; |
| 1788 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1789 | } |
| 1790 | } |
| 1791 | |
| 1792 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1793 | dig_nid = codec->start_nid; |
| 1794 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1795 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1796 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1797 | continue; |
| 1798 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1799 | continue; |
| 1800 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1801 | continue; |
| 1802 | err = get_connection_index(codec, dig_nid, |
| 1803 | spec->autocfg.dig_in_pin); |
| 1804 | if (err >= 0) { |
| 1805 | spec->dig_in_nid = dig_nid; |
| 1806 | break; |
| 1807 | } |
| 1808 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1809 | } |
| 1810 | } |
| 1811 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1812 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1813 | * ALC888 |
| 1814 | */ |
| 1815 | |
| 1816 | /* |
| 1817 | * 2ch mode |
| 1818 | */ |
| 1819 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1820 | /* Mic-in jack as mic in */ |
| 1821 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1822 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1823 | /* Line-in jack as Line in */ |
| 1824 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1825 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1826 | /* Line-Out as Front */ |
| 1827 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1828 | { } /* end */ |
| 1829 | }; |
| 1830 | |
| 1831 | /* |
| 1832 | * 4ch mode |
| 1833 | */ |
| 1834 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1835 | /* Mic-in jack as mic in */ |
| 1836 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1837 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1838 | /* Line-in jack as Surround */ |
| 1839 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1840 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1841 | /* Line-Out as Front */ |
| 1842 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1843 | { } /* end */ |
| 1844 | }; |
| 1845 | |
| 1846 | /* |
| 1847 | * 6ch mode |
| 1848 | */ |
| 1849 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1850 | /* Mic-in jack as CLFE */ |
| 1851 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1852 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1853 | /* Line-in jack as Surround */ |
| 1854 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1855 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1856 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1857 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1858 | { } /* end */ |
| 1859 | }; |
| 1860 | |
| 1861 | /* |
| 1862 | * 8ch mode |
| 1863 | */ |
| 1864 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1865 | /* Mic-in jack as CLFE */ |
| 1866 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1867 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1868 | /* Line-in jack as Surround */ |
| 1869 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1870 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1871 | /* Line-Out as Side */ |
| 1872 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1873 | { } /* end */ |
| 1874 | }; |
| 1875 | |
| 1876 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1877 | { 2, alc888_4ST_ch2_intel_init }, |
| 1878 | { 4, alc888_4ST_ch4_intel_init }, |
| 1879 | { 6, alc888_4ST_ch6_intel_init }, |
| 1880 | { 8, alc888_4ST_ch8_intel_init }, |
| 1881 | }; |
| 1882 | |
| 1883 | /* |
| 1884 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1885 | */ |
| 1886 | |
| 1887 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1888 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1889 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1890 | /* Connect Internal HP to Front */ |
| 1891 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1892 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1893 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1894 | /* Connect Bass HP to Front */ |
| 1895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1896 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1897 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1898 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1899 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1900 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1901 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1902 | /* Connect Mic jack to CLFE */ |
| 1903 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1904 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1905 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1906 | /* Connect Line-in jack to Surround */ |
| 1907 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1908 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1909 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1910 | /* Connect HP out jack to Front */ |
| 1911 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1912 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1913 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1914 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1915 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1916 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1917 | {} |
| 1918 | }; |
| 1919 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1920 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1921 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1922 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1923 | } |
| 1924 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1925 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1926 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1927 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1928 | if (codec->vendor_id == 0x10ec0880) |
| 1929 | res >>= 28; |
| 1930 | else |
| 1931 | res >>= 26; |
| 1932 | if (res == ALC880_HP_EVENT) |
| 1933 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1934 | } |
| 1935 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1936 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1937 | { |
| 1938 | struct alc_spec *spec = codec->spec; |
| 1939 | |
| 1940 | spec->autocfg.hp_pins[0] = 0x15; |
| 1941 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1942 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1943 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1944 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1945 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1946 | } |
| 1947 | |
| 1948 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1949 | { |
| 1950 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1951 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1952 | } |
| 1953 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1954 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1955 | { |
| 1956 | struct alc_spec *spec = codec->spec; |
| 1957 | |
| 1958 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1959 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1960 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1961 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1962 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1963 | |
| 1964 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1965 | * ALC888 Acer Aspire 4930G model |
| 1966 | */ |
| 1967 | |
| 1968 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1969 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1970 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1971 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1973 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1974 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1975 | /* Connect Internal HP to front */ |
| 1976 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1978 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1979 | /* Connect HP out to front */ |
| 1980 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1981 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1982 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1983 | { } |
| 1984 | }; |
| 1985 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1986 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1987 | * ALC888 Acer Aspire 6530G model |
| 1988 | */ |
| 1989 | |
| 1990 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1991 | /* Route to built-in subwoofer as well as speakers */ |
| 1992 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1993 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1994 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1995 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1996 | /* Bias voltage on for external mic port */ |
| 1997 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1998 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1999 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2000 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2002 | /* Enable unsolicited event for HP jack */ |
| 2003 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2004 | /* Enable speaker output */ |
| 2005 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2006 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2007 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2008 | /* Enable headphone output */ |
| 2009 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2010 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2011 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2012 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2013 | { } |
| 2014 | }; |
| 2015 | |
| 2016 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2017 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2018 | */ |
| 2019 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2020 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2021 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2022 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2023 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2024 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2025 | /* Enable unsolicited event for HP jack */ |
| 2026 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2027 | /* Connect Internal Front to Front */ |
| 2028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2029 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2030 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2031 | /* Connect Internal Rear to Rear */ |
| 2032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2033 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2034 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2035 | /* Connect Internal CLFE to CLFE */ |
| 2036 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2037 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2038 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2039 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2040 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2041 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2042 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2043 | /* Enable all DACs */ |
| 2044 | /* DAC DISABLE/MUTE 1? */ |
| 2045 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2046 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2047 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2048 | /* DAC DISABLE/MUTE 2? */ |
| 2049 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2050 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2051 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2052 | /* DMIC fix |
| 2053 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2054 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2055 | * makes the signal become a difference/sum signal instead of standard |
| 2056 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2057 | * codec replicate the sum signal to both channels, turning it into a |
| 2058 | * normal mono mic. |
| 2059 | */ |
| 2060 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2061 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2062 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2063 | { } |
| 2064 | }; |
| 2065 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2066 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2067 | /* Front mic only available on one ADC */ |
| 2068 | { |
| 2069 | .num_items = 4, |
| 2070 | .items = { |
| 2071 | { "Mic", 0x0 }, |
| 2072 | { "Line", 0x2 }, |
| 2073 | { "CD", 0x4 }, |
| 2074 | { "Front Mic", 0xb }, |
| 2075 | }, |
| 2076 | }, |
| 2077 | { |
| 2078 | .num_items = 3, |
| 2079 | .items = { |
| 2080 | { "Mic", 0x0 }, |
| 2081 | { "Line", 0x2 }, |
| 2082 | { "CD", 0x4 }, |
| 2083 | }, |
| 2084 | } |
| 2085 | }; |
| 2086 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2087 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2088 | /* Interal mic only available on one ADC */ |
| 2089 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2090 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2091 | .items = { |
| 2092 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2093 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2094 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2095 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2096 | { "Int Mic", 0xb }, |
| 2097 | }, |
| 2098 | }, |
| 2099 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2100 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2101 | .items = { |
| 2102 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2103 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2104 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2105 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2106 | }, |
| 2107 | } |
| 2108 | }; |
| 2109 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2110 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2111 | /* Digital mic only available on first "ADC" */ |
| 2112 | { |
| 2113 | .num_items = 5, |
| 2114 | .items = { |
| 2115 | { "Mic", 0x0 }, |
| 2116 | { "Line", 0x2 }, |
| 2117 | { "CD", 0x4 }, |
| 2118 | { "Front Mic", 0xb }, |
| 2119 | { "Input Mix", 0xa }, |
| 2120 | }, |
| 2121 | }, |
| 2122 | { |
| 2123 | .num_items = 4, |
| 2124 | .items = { |
| 2125 | { "Mic", 0x0 }, |
| 2126 | { "Line", 0x2 }, |
| 2127 | { "CD", 0x4 }, |
| 2128 | { "Input Mix", 0xa }, |
| 2129 | }, |
| 2130 | }, |
| 2131 | { |
| 2132 | .num_items = 4, |
| 2133 | .items = { |
| 2134 | { "Mic", 0x0 }, |
| 2135 | { "Line", 0x2 }, |
| 2136 | { "CD", 0x4 }, |
| 2137 | { "Input Mix", 0xa }, |
| 2138 | }, |
| 2139 | } |
| 2140 | }; |
| 2141 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2142 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2143 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2144 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2145 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2146 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2147 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2148 | HDA_OUTPUT), |
| 2149 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2150 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2151 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2152 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2153 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2154 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2155 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2157 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2158 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2159 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 2160 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2161 | { } /* end */ |
| 2162 | }; |
| 2163 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2164 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2165 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2166 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2167 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2168 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2169 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2170 | HDA_OUTPUT), |
| 2171 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2172 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2173 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2174 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2175 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2176 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2177 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 2178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2179 | { } /* end */ |
| 2180 | }; |
| 2181 | |
| 2182 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2183 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2184 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2185 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2186 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2187 | spec->autocfg.hp_pins[0] = 0x15; |
| 2188 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2189 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2190 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2191 | } |
| 2192 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2193 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2194 | { |
| 2195 | struct alc_spec *spec = codec->spec; |
| 2196 | |
| 2197 | spec->autocfg.hp_pins[0] = 0x15; |
| 2198 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2199 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2200 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2201 | } |
| 2202 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2203 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2204 | { |
| 2205 | struct alc_spec *spec = codec->spec; |
| 2206 | |
| 2207 | spec->autocfg.hp_pins[0] = 0x15; |
| 2208 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2209 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2210 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2211 | } |
| 2212 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2213 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2214 | * ALC880 3-stack model |
| 2215 | * |
| 2216 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2217 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2218 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2219 | */ |
| 2220 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2221 | static hda_nid_t alc880_dac_nids[4] = { |
| 2222 | /* front, rear, clfe, rear_surr */ |
| 2223 | 0x02, 0x05, 0x04, 0x03 |
| 2224 | }; |
| 2225 | |
| 2226 | static hda_nid_t alc880_adc_nids[3] = { |
| 2227 | /* ADC0-2 */ |
| 2228 | 0x07, 0x08, 0x09, |
| 2229 | }; |
| 2230 | |
| 2231 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2232 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2233 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2234 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2235 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2236 | /* ADC1-2 */ |
| 2237 | 0x08, 0x09, |
| 2238 | }; |
| 2239 | |
| 2240 | #define ALC880_DIGOUT_NID 0x06 |
| 2241 | #define ALC880_DIGIN_NID 0x0a |
| 2242 | |
| 2243 | static struct hda_input_mux alc880_capture_source = { |
| 2244 | .num_items = 4, |
| 2245 | .items = { |
| 2246 | { "Mic", 0x0 }, |
| 2247 | { "Front Mic", 0x3 }, |
| 2248 | { "Line", 0x2 }, |
| 2249 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2250 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2251 | }; |
| 2252 | |
| 2253 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2254 | /* 2ch mode */ |
| 2255 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2256 | /* set line-in to input, mute it */ |
| 2257 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2258 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2259 | /* set mic-in to input vref 80%, mute it */ |
| 2260 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2261 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2262 | { } /* end */ |
| 2263 | }; |
| 2264 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2265 | /* 6ch mode */ |
| 2266 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2267 | /* set line-in to output, unmute it */ |
| 2268 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2269 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2270 | /* set mic-in to output, unmute it */ |
| 2271 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2272 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2273 | { } /* end */ |
| 2274 | }; |
| 2275 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2276 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2277 | { 2, alc880_threestack_ch2_init }, |
| 2278 | { 6, alc880_threestack_ch6_init }, |
| 2279 | }; |
| 2280 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2281 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2282 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2283 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2284 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2285 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2286 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2287 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2288 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2289 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2290 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2291 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2292 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2293 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2294 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2295 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2296 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2297 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2298 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2299 | { |
| 2300 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2301 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2302 | .info = alc_ch_mode_info, |
| 2303 | .get = alc_ch_mode_get, |
| 2304 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2305 | }, |
| 2306 | { } /* end */ |
| 2307 | }; |
| 2308 | |
| 2309 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2310 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2311 | struct snd_ctl_elem_info *uinfo) |
| 2312 | { |
| 2313 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2314 | struct alc_spec *spec = codec->spec; |
| 2315 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2316 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2317 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2318 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2319 | HDA_INPUT); |
| 2320 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2321 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2322 | return err; |
| 2323 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2324 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2325 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2326 | unsigned int size, unsigned int __user *tlv) |
| 2327 | { |
| 2328 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2329 | struct alc_spec *spec = codec->spec; |
| 2330 | int err; |
| 2331 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2332 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2333 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2334 | HDA_INPUT); |
| 2335 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2336 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2337 | return err; |
| 2338 | } |
| 2339 | |
| 2340 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2341 | struct snd_ctl_elem_value *ucontrol); |
| 2342 | |
| 2343 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2344 | struct snd_ctl_elem_value *ucontrol, |
| 2345 | getput_call_t func) |
| 2346 | { |
| 2347 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2348 | struct alc_spec *spec = codec->spec; |
| 2349 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2350 | int err; |
| 2351 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2352 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2353 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2354 | 3, 0, HDA_INPUT); |
| 2355 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2356 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2357 | return err; |
| 2358 | } |
| 2359 | |
| 2360 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2361 | struct snd_ctl_elem_value *ucontrol) |
| 2362 | { |
| 2363 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2364 | snd_hda_mixer_amp_volume_get); |
| 2365 | } |
| 2366 | |
| 2367 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2368 | struct snd_ctl_elem_value *ucontrol) |
| 2369 | { |
| 2370 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2371 | snd_hda_mixer_amp_volume_put); |
| 2372 | } |
| 2373 | |
| 2374 | /* capture mixer elements */ |
| 2375 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2376 | |
| 2377 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2378 | struct snd_ctl_elem_value *ucontrol) |
| 2379 | { |
| 2380 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2381 | snd_hda_mixer_amp_switch_get); |
| 2382 | } |
| 2383 | |
| 2384 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2385 | struct snd_ctl_elem_value *ucontrol) |
| 2386 | { |
| 2387 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2388 | snd_hda_mixer_amp_switch_put); |
| 2389 | } |
| 2390 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2391 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2392 | { \ |
| 2393 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2394 | .name = "Capture Switch", \ |
| 2395 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2396 | .count = num, \ |
| 2397 | .info = alc_cap_sw_info, \ |
| 2398 | .get = alc_cap_sw_get, \ |
| 2399 | .put = alc_cap_sw_put, \ |
| 2400 | }, \ |
| 2401 | { \ |
| 2402 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2403 | .name = "Capture Volume", \ |
| 2404 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2405 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2406 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2407 | .count = num, \ |
| 2408 | .info = alc_cap_vol_info, \ |
| 2409 | .get = alc_cap_vol_get, \ |
| 2410 | .put = alc_cap_vol_put, \ |
| 2411 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2412 | } |
| 2413 | |
| 2414 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2415 | { \ |
| 2416 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2417 | /* .name = "Capture Source", */ \ |
| 2418 | .name = "Input Source", \ |
| 2419 | .count = num, \ |
| 2420 | .info = alc_mux_enum_info, \ |
| 2421 | .get = alc_mux_enum_get, \ |
| 2422 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2423 | } |
| 2424 | |
| 2425 | #define DEFINE_CAPMIX(num) \ |
| 2426 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2427 | _DEFINE_CAPMIX(num), \ |
| 2428 | _DEFINE_CAPSRC(num), \ |
| 2429 | { } /* end */ \ |
| 2430 | } |
| 2431 | |
| 2432 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2433 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2434 | _DEFINE_CAPMIX(num), \ |
| 2435 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2436 | } |
| 2437 | |
| 2438 | /* up to three ADCs */ |
| 2439 | DEFINE_CAPMIX(1); |
| 2440 | DEFINE_CAPMIX(2); |
| 2441 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2442 | DEFINE_CAPMIX_NOSRC(1); |
| 2443 | DEFINE_CAPMIX_NOSRC(2); |
| 2444 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2445 | |
| 2446 | /* |
| 2447 | * ALC880 5-stack model |
| 2448 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2449 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2450 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2451 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2452 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2453 | */ |
| 2454 | |
| 2455 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2456 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2457 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2458 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2459 | { } /* end */ |
| 2460 | }; |
| 2461 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2462 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2463 | /* 6ch mode */ |
| 2464 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2465 | /* set line-in to input, mute it */ |
| 2466 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2467 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2468 | { } /* end */ |
| 2469 | }; |
| 2470 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2471 | /* 8ch mode */ |
| 2472 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2473 | /* set line-in to output, unmute it */ |
| 2474 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2475 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2476 | { } /* end */ |
| 2477 | }; |
| 2478 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2479 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2480 | { 6, alc880_fivestack_ch6_init }, |
| 2481 | { 8, alc880_fivestack_ch8_init }, |
| 2482 | }; |
| 2483 | |
| 2484 | |
| 2485 | /* |
| 2486 | * ALC880 6-stack model |
| 2487 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2488 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2489 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2490 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2491 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2492 | */ |
| 2493 | |
| 2494 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2495 | /* front, rear, clfe, rear_surr */ |
| 2496 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2497 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2498 | |
| 2499 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2500 | .num_items = 4, |
| 2501 | .items = { |
| 2502 | { "Mic", 0x0 }, |
| 2503 | { "Front Mic", 0x1 }, |
| 2504 | { "Line", 0x2 }, |
| 2505 | { "CD", 0x4 }, |
| 2506 | }, |
| 2507 | }; |
| 2508 | |
| 2509 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2510 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2511 | { 8, NULL }, |
| 2512 | }; |
| 2513 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2514 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2515 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2516 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2517 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2518 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2519 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2520 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2521 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2522 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2523 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2524 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2525 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2526 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2527 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2528 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2531 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2532 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2533 | { |
| 2534 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2535 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2536 | .info = alc_ch_mode_info, |
| 2537 | .get = alc_ch_mode_get, |
| 2538 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2539 | }, |
| 2540 | { } /* end */ |
| 2541 | }; |
| 2542 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2543 | |
| 2544 | /* |
| 2545 | * ALC880 W810 model |
| 2546 | * |
| 2547 | * W810 has rear IO for: |
| 2548 | * Front (DAC 02) |
| 2549 | * Surround (DAC 03) |
| 2550 | * Center/LFE (DAC 04) |
| 2551 | * Digital out (06) |
| 2552 | * |
| 2553 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2554 | * 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] | 2555 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2556 | * There is a variable resistor to control the speaker or headphone |
| 2557 | * volume. This is a hardware-only device without a software API. |
| 2558 | * |
| 2559 | * Plugging headphones in will disable the internal speakers. This is |
| 2560 | * implemented in hardware, not via the driver using jack sense. In |
| 2561 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2562 | * disable both the speakers and headphones. |
| 2563 | * |
| 2564 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2565 | * These may not do anything useful with this driver yet, because I |
| 2566 | * haven't setup any initialization verbs for these yet... |
| 2567 | */ |
| 2568 | |
| 2569 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2570 | /* front, rear/surround, clfe */ |
| 2571 | 0x02, 0x03, 0x04 |
| 2572 | }; |
| 2573 | |
| 2574 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2575 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2576 | { 6, NULL } |
| 2577 | }; |
| 2578 | |
| 2579 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2580 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2581 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2582 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2583 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2584 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2585 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2586 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2587 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2588 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2589 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2590 | { } /* end */ |
| 2591 | }; |
| 2592 | |
| 2593 | |
| 2594 | /* |
| 2595 | * Z710V model |
| 2596 | * |
| 2597 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2598 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2599 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2600 | */ |
| 2601 | |
| 2602 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2603 | 0x02 |
| 2604 | }; |
| 2605 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2606 | |
| 2607 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2608 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2609 | { 2, NULL } |
| 2610 | }; |
| 2611 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2612 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2613 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2614 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2615 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2616 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2617 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2618 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2619 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2621 | { } /* end */ |
| 2622 | }; |
| 2623 | |
| 2624 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2625 | /* |
| 2626 | * ALC880 F1734 model |
| 2627 | * |
| 2628 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2629 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2630 | */ |
| 2631 | |
| 2632 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2633 | 0x03 |
| 2634 | }; |
| 2635 | #define ALC880_F1734_HP_DAC 0x02 |
| 2636 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2637 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2638 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2639 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2640 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2641 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2642 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2643 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2644 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2645 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2646 | { } /* end */ |
| 2647 | }; |
| 2648 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2649 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2650 | .num_items = 2, |
| 2651 | .items = { |
| 2652 | { "Mic", 0x1 }, |
| 2653 | { "CD", 0x4 }, |
| 2654 | }, |
| 2655 | }; |
| 2656 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2657 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2658 | /* |
| 2659 | * ALC880 ASUS model |
| 2660 | * |
| 2661 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2662 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2663 | * Mic = 0x18, Line = 0x1a |
| 2664 | */ |
| 2665 | |
| 2666 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2667 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2668 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2669 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2670 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2671 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2672 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2673 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2674 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2675 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2676 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2677 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2678 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2679 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2680 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2681 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2682 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2683 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2684 | { |
| 2685 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2686 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2687 | .info = alc_ch_mode_info, |
| 2688 | .get = alc_ch_mode_get, |
| 2689 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2690 | }, |
| 2691 | { } /* end */ |
| 2692 | }; |
| 2693 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2694 | /* |
| 2695 | * ALC880 ASUS W1V model |
| 2696 | * |
| 2697 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2698 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2699 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2700 | */ |
| 2701 | |
| 2702 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2703 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2704 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2705 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2706 | { } /* end */ |
| 2707 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2708 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2709 | /* TCL S700 */ |
| 2710 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2711 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2712 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2714 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2715 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2716 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2717 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2718 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2719 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2720 | { } /* end */ |
| 2721 | }; |
| 2722 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2723 | /* Uniwill */ |
| 2724 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2725 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2726 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2727 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2728 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2729 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2730 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2731 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2732 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2733 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2734 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2735 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2736 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2737 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2738 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2739 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2740 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2741 | { |
| 2742 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2743 | .name = "Channel Mode", |
| 2744 | .info = alc_ch_mode_info, |
| 2745 | .get = alc_ch_mode_get, |
| 2746 | .put = alc_ch_mode_put, |
| 2747 | }, |
| 2748 | { } /* end */ |
| 2749 | }; |
| 2750 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2751 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2752 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2753 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2754 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2755 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2756 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2757 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2758 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2759 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2760 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2761 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2762 | { } /* end */ |
| 2763 | }; |
| 2764 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2765 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2766 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2767 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2768 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2769 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2770 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2771 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2772 | { } /* end */ |
| 2773 | }; |
| 2774 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2775 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2776 | * virtual master controls |
| 2777 | */ |
| 2778 | |
| 2779 | /* |
| 2780 | * slave controls for virtual master |
| 2781 | */ |
| 2782 | static const char *alc_slave_vols[] = { |
| 2783 | "Front Playback Volume", |
| 2784 | "Surround Playback Volume", |
| 2785 | "Center Playback Volume", |
| 2786 | "LFE Playback Volume", |
| 2787 | "Side Playback Volume", |
| 2788 | "Headphone Playback Volume", |
| 2789 | "Speaker Playback Volume", |
| 2790 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2791 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2792 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2793 | NULL, |
| 2794 | }; |
| 2795 | |
| 2796 | static const char *alc_slave_sws[] = { |
| 2797 | "Front Playback Switch", |
| 2798 | "Surround Playback Switch", |
| 2799 | "Center Playback Switch", |
| 2800 | "LFE Playback Switch", |
| 2801 | "Side Playback Switch", |
| 2802 | "Headphone Playback Switch", |
| 2803 | "Speaker Playback Switch", |
| 2804 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2805 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2806 | "Line-Out Playback Switch", |
| 2807 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2808 | NULL, |
| 2809 | }; |
| 2810 | |
| 2811 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2812 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2813 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2814 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2815 | #define NID_MAPPING (-1) |
| 2816 | |
| 2817 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2818 | #define SUBDEV_HP_ (1 << 6) |
| 2819 | #define SUBDEV_LINE_ (2 << 6) |
| 2820 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2821 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2822 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2823 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2824 | static void alc_free_kctls(struct hda_codec *codec); |
| 2825 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2826 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2827 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2828 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2829 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2830 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2831 | { } /* end */ |
| 2832 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2833 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2834 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2835 | static int alc_build_controls(struct hda_codec *codec) |
| 2836 | { |
| 2837 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2838 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2839 | struct snd_kcontrol_new *knew; |
| 2840 | int i, j, err; |
| 2841 | unsigned int u; |
| 2842 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2843 | |
| 2844 | for (i = 0; i < spec->num_mixers; i++) { |
| 2845 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2846 | if (err < 0) |
| 2847 | return err; |
| 2848 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2849 | if (spec->cap_mixer) { |
| 2850 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2851 | if (err < 0) |
| 2852 | return err; |
| 2853 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2854 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2855 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2856 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2857 | if (err < 0) |
| 2858 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2859 | if (!spec->no_analog) { |
| 2860 | err = snd_hda_create_spdif_share_sw(codec, |
| 2861 | &spec->multiout); |
| 2862 | if (err < 0) |
| 2863 | return err; |
| 2864 | spec->multiout.share_spdif = 1; |
| 2865 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2866 | } |
| 2867 | if (spec->dig_in_nid) { |
| 2868 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2869 | if (err < 0) |
| 2870 | return err; |
| 2871 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2872 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2873 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2874 | /* create beep controls if needed */ |
| 2875 | if (spec->beep_amp) { |
| 2876 | struct snd_kcontrol_new *knew; |
| 2877 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2878 | struct snd_kcontrol *kctl; |
| 2879 | kctl = snd_ctl_new1(knew, codec); |
| 2880 | if (!kctl) |
| 2881 | return -ENOMEM; |
| 2882 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2883 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2884 | if (err < 0) |
| 2885 | return err; |
| 2886 | } |
| 2887 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2888 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2889 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2890 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2891 | if (!spec->no_analog && |
| 2892 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2893 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2894 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2895 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2896 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2897 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2898 | if (err < 0) |
| 2899 | return err; |
| 2900 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2901 | if (!spec->no_analog && |
| 2902 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2903 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2904 | NULL, alc_slave_sws); |
| 2905 | if (err < 0) |
| 2906 | return err; |
| 2907 | } |
| 2908 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2909 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2910 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2911 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2912 | if (!kctl) |
| 2913 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2914 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2915 | hda_nid_t *nids = spec->capsrc_nids; |
| 2916 | if (!nids) |
| 2917 | nids = spec->adc_nids; |
| 2918 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 2919 | if (err < 0) |
| 2920 | return err; |
| 2921 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2922 | } |
| 2923 | if (spec->cap_mixer) { |
| 2924 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2925 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2926 | if (kname && strcmp(knew->name, kname) == 0) |
| 2927 | continue; |
| 2928 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2929 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2930 | err = snd_hda_add_nid(codec, kctl, i, |
| 2931 | spec->adc_nids[i]); |
| 2932 | if (err < 0) |
| 2933 | return err; |
| 2934 | } |
| 2935 | } |
| 2936 | } |
| 2937 | |
| 2938 | /* other nid->control mapping */ |
| 2939 | for (i = 0; i < spec->num_mixers; i++) { |
| 2940 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2941 | if (knew->iface != NID_MAPPING) |
| 2942 | continue; |
| 2943 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2944 | if (kctl == NULL) |
| 2945 | continue; |
| 2946 | u = knew->subdevice; |
| 2947 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2948 | nid = u & 0x3f; |
| 2949 | if (nid == 0) |
| 2950 | continue; |
| 2951 | switch (u & 0xc0) { |
| 2952 | case SUBDEV_SPEAKER_: |
| 2953 | nid = spec->autocfg.speaker_pins[nid]; |
| 2954 | break; |
| 2955 | case SUBDEV_LINE_: |
| 2956 | nid = spec->autocfg.line_out_pins[nid]; |
| 2957 | break; |
| 2958 | case SUBDEV_HP_: |
| 2959 | nid = spec->autocfg.hp_pins[nid]; |
| 2960 | break; |
| 2961 | default: |
| 2962 | continue; |
| 2963 | } |
| 2964 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2965 | if (err < 0) |
| 2966 | return err; |
| 2967 | } |
| 2968 | u = knew->private_value; |
| 2969 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2970 | nid = u & 0xff; |
| 2971 | if (nid == 0) |
| 2972 | continue; |
| 2973 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2974 | if (err < 0) |
| 2975 | return err; |
| 2976 | } |
| 2977 | } |
| 2978 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2979 | |
| 2980 | alc_free_kctls(codec); /* no longer needed */ |
| 2981 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2982 | return 0; |
| 2983 | } |
| 2984 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2985 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2986 | /* |
| 2987 | * initialize the codec volumes, etc |
| 2988 | */ |
| 2989 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2990 | /* |
| 2991 | * generic initialization of ADC, input mixers and output mixers |
| 2992 | */ |
| 2993 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2994 | /* |
| 2995 | * Unmute ADC0-2 and set the default input to mic-in |
| 2996 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2997 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2998 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2999 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3000 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3001 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3002 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3003 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3004 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3005 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3006 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3007 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3008 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3009 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3010 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3014 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3015 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3017 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3018 | /* |
| 3019 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3020 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3021 | /* set vol=0 to output mixers */ |
| 3022 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3023 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3024 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3025 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3026 | /* set up input amps for analog loopback */ |
| 3027 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3028 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3029 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3030 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3031 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3032 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3033 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3034 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3035 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3036 | |
| 3037 | { } |
| 3038 | }; |
| 3039 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3040 | /* |
| 3041 | * 3-stack pin configuration: |
| 3042 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3043 | */ |
| 3044 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3045 | /* |
| 3046 | * preset connection lists of input pins |
| 3047 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3048 | */ |
| 3049 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3050 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3051 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3052 | |
| 3053 | /* |
| 3054 | * Set pin mode and muting |
| 3055 | */ |
| 3056 | /* set front pin widgets 0x14 for output */ |
| 3057 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3058 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3059 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3060 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3061 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3062 | /* Mic2 (as headphone out) for HP output */ |
| 3063 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3064 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3065 | /* Line In pin widget for input */ |
| 3066 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3067 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3068 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3069 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3070 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3071 | /* CD pin widget for input */ |
| 3072 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3073 | |
| 3074 | { } |
| 3075 | }; |
| 3076 | |
| 3077 | /* |
| 3078 | * 5-stack pin configuration: |
| 3079 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3080 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3081 | */ |
| 3082 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3083 | /* |
| 3084 | * preset connection lists of input pins |
| 3085 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3086 | */ |
| 3087 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3088 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3089 | |
| 3090 | /* |
| 3091 | * Set pin mode and muting |
| 3092 | */ |
| 3093 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3094 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3095 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3096 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3097 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3098 | /* unmute pins for output (no gain on this amp) */ |
| 3099 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3100 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3101 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3102 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3103 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3104 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3105 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3106 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3107 | /* Mic2 (as headphone out) for HP output */ |
| 3108 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3109 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3110 | /* Line In pin widget for input */ |
| 3111 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3112 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3113 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3114 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3115 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3116 | /* CD pin widget for input */ |
| 3117 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3118 | |
| 3119 | { } |
| 3120 | }; |
| 3121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3122 | /* |
| 3123 | * W810 pin configuration: |
| 3124 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3125 | */ |
| 3126 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3127 | /* hphone/speaker input selector: front DAC */ |
| 3128 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3129 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3130 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3131 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3132 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3133 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3134 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3135 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3136 | |
| 3137 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3138 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3139 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3140 | { } |
| 3141 | }; |
| 3142 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3143 | /* |
| 3144 | * Z71V pin configuration: |
| 3145 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3146 | */ |
| 3147 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3148 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3149 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3150 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3151 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3152 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3153 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3154 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3155 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3156 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3157 | |
| 3158 | { } |
| 3159 | }; |
| 3160 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3161 | /* |
| 3162 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3163 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3164 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3165 | */ |
| 3166 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3167 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3168 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3169 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3170 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3171 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3172 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3173 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3174 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3175 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3176 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3177 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3178 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3179 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3180 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3181 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3182 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3183 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3184 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3185 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3186 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3187 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3188 | { } |
| 3189 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3190 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3191 | /* |
| 3192 | * Uniwill pin configuration: |
| 3193 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3194 | * line = 0x1a |
| 3195 | */ |
| 3196 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3197 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3198 | |
| 3199 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3200 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3201 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3202 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3203 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3204 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3205 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3206 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3207 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3208 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3209 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3210 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3211 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3212 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3213 | |
| 3214 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3215 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3216 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3217 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3218 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3219 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3220 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3221 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3222 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3223 | |
| 3224 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3225 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3226 | |
| 3227 | { } |
| 3228 | }; |
| 3229 | |
| 3230 | /* |
| 3231 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3232 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3233 | */ |
| 3234 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3235 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3236 | |
| 3237 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3238 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3239 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3240 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3241 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3242 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3243 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3244 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3245 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3246 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3247 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3248 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3249 | |
| 3250 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3251 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3252 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3253 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3254 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3255 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3256 | |
| 3257 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3258 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3259 | |
| 3260 | { } |
| 3261 | }; |
| 3262 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3263 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3264 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3265 | { } |
| 3266 | }; |
| 3267 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3268 | /* auto-toggle front mic */ |
| 3269 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 3270 | { |
| 3271 | unsigned int present; |
| 3272 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3273 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3274 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3275 | bits = present ? HDA_AMP_MUTE : 0; |
| 3276 | 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] | 3277 | } |
| 3278 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3279 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3280 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3281 | struct alc_spec *spec = codec->spec; |
| 3282 | |
| 3283 | spec->autocfg.hp_pins[0] = 0x14; |
| 3284 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3285 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3286 | } |
| 3287 | |
| 3288 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3289 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3290 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3291 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3292 | } |
| 3293 | |
| 3294 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3295 | unsigned int res) |
| 3296 | { |
| 3297 | /* Looks like the unsol event is incompatible with the standard |
| 3298 | * definition. 4bit tag is placed at 28 bit! |
| 3299 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3300 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3301 | case ALC880_MIC_EVENT: |
| 3302 | alc880_uniwill_mic_automute(codec); |
| 3303 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3304 | default: |
| 3305 | alc_automute_amp_unsol_event(codec, res); |
| 3306 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3307 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3308 | } |
| 3309 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3310 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3311 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3312 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3313 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3314 | spec->autocfg.hp_pins[0] = 0x14; |
| 3315 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3316 | } |
| 3317 | |
| 3318 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3319 | { |
| 3320 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3321 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3322 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3323 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3324 | present &= HDA_AMP_VOLMASK; |
| 3325 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3326 | HDA_AMP_VOLMASK, present); |
| 3327 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3328 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3329 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3330 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3331 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3332 | unsigned int res) |
| 3333 | { |
| 3334 | /* Looks like the unsol event is incompatible with the standard |
| 3335 | * definition. 4bit tag is placed at 28 bit! |
| 3336 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3337 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3338 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3339 | else |
| 3340 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3341 | } |
| 3342 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3343 | /* |
| 3344 | * F1734 pin configuration: |
| 3345 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3346 | */ |
| 3347 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3348 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3349 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3350 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3351 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3352 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3353 | |
| 3354 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3355 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3356 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3357 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3358 | |
| 3359 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3360 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3361 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3362 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3363 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3364 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3365 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3366 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3367 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3368 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3369 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3370 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3371 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3372 | { } |
| 3373 | }; |
| 3374 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3375 | /* |
| 3376 | * ASUS pin configuration: |
| 3377 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3378 | */ |
| 3379 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3380 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3381 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3382 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3383 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3384 | |
| 3385 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3386 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3387 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3388 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3389 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3390 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3391 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3392 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3393 | |
| 3394 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3395 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3396 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3397 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3398 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3399 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3400 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3401 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3402 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3403 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3404 | { } |
| 3405 | }; |
| 3406 | |
| 3407 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3408 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3409 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3410 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3411 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3412 | /* Clevo m520g init */ |
| 3413 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3414 | /* headphone output */ |
| 3415 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3416 | /* line-out */ |
| 3417 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3418 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3419 | /* Line-in */ |
| 3420 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3421 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3422 | /* CD */ |
| 3423 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3424 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3425 | /* Mic1 (rear panel) */ |
| 3426 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3427 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3428 | /* Mic2 (front panel) */ |
| 3429 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3430 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3431 | /* headphone */ |
| 3432 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3433 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3434 | /* change to EAPD mode */ |
| 3435 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3436 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3437 | |
| 3438 | { } |
| 3439 | }; |
| 3440 | |
| 3441 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3442 | /* change to EAPD mode */ |
| 3443 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3444 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3445 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3446 | /* Headphone output */ |
| 3447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3448 | /* Front output*/ |
| 3449 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3450 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3451 | |
| 3452 | /* Line In pin widget for input */ |
| 3453 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3454 | /* CD pin widget for input */ |
| 3455 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3456 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3457 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3458 | |
| 3459 | /* change to EAPD mode */ |
| 3460 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3461 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3462 | |
| 3463 | { } |
| 3464 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3465 | |
| 3466 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3467 | * LG m1 express dual |
| 3468 | * |
| 3469 | * Pin assignment: |
| 3470 | * Rear Line-In/Out (blue): 0x14 |
| 3471 | * Build-in Mic-In: 0x15 |
| 3472 | * Speaker-out: 0x17 |
| 3473 | * HP-Out (green): 0x1b |
| 3474 | * Mic-In/Out (red): 0x19 |
| 3475 | * SPDIF-Out: 0x1e |
| 3476 | */ |
| 3477 | |
| 3478 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3479 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3480 | 0x05, 0x02, 0x03 |
| 3481 | }; |
| 3482 | |
| 3483 | /* seems analog CD is not working */ |
| 3484 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3485 | .num_items = 3, |
| 3486 | .items = { |
| 3487 | { "Mic", 0x1 }, |
| 3488 | { "Line", 0x5 }, |
| 3489 | { "Internal Mic", 0x6 }, |
| 3490 | }, |
| 3491 | }; |
| 3492 | |
| 3493 | /* 2,4,6 channel modes */ |
| 3494 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3495 | /* set line-in and mic-in to input */ |
| 3496 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3497 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3498 | { } |
| 3499 | }; |
| 3500 | |
| 3501 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3502 | /* set line-in to out and mic-in to input */ |
| 3503 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3504 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3505 | { } |
| 3506 | }; |
| 3507 | |
| 3508 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3509 | /* set line-in and mic-in to output */ |
| 3510 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3511 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3512 | { } |
| 3513 | }; |
| 3514 | |
| 3515 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3516 | { 2, alc880_lg_ch2_init }, |
| 3517 | { 4, alc880_lg_ch4_init }, |
| 3518 | { 6, alc880_lg_ch6_init }, |
| 3519 | }; |
| 3520 | |
| 3521 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3522 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3523 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3524 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3525 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3526 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3527 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3528 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3529 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3530 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3531 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3532 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3533 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3534 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3535 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3536 | { |
| 3537 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3538 | .name = "Channel Mode", |
| 3539 | .info = alc_ch_mode_info, |
| 3540 | .get = alc_ch_mode_get, |
| 3541 | .put = alc_ch_mode_put, |
| 3542 | }, |
| 3543 | { } /* end */ |
| 3544 | }; |
| 3545 | |
| 3546 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3547 | /* set capture source to mic-in */ |
| 3548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3551 | /* mute all amp mixer inputs */ |
| 3552 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3553 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3554 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3555 | /* line-in to input */ |
| 3556 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3557 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3558 | /* built-in mic */ |
| 3559 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3560 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3561 | /* speaker-out */ |
| 3562 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3563 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3564 | /* mic-in to input */ |
| 3565 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3566 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3567 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3568 | /* HP-out */ |
| 3569 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3570 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3571 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3572 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3573 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3574 | { } |
| 3575 | }; |
| 3576 | |
| 3577 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3578 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3579 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3580 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3581 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3582 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3583 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3584 | } |
| 3585 | |
| 3586 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3587 | * LG LW20 |
| 3588 | * |
| 3589 | * Pin assignment: |
| 3590 | * Speaker-out: 0x14 |
| 3591 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3592 | * Built-in Mic-In: 0x19 |
| 3593 | * Line-In: 0x1b |
| 3594 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3595 | * SPDIF-Out: 0x1e |
| 3596 | */ |
| 3597 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3598 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3599 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3600 | .items = { |
| 3601 | { "Mic", 0x0 }, |
| 3602 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3603 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3604 | }, |
| 3605 | }; |
| 3606 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3607 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3608 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3609 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3610 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3611 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3612 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3613 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3614 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3615 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3616 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3617 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3618 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3619 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3620 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3621 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3622 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3623 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3624 | { |
| 3625 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3626 | .name = "Channel Mode", |
| 3627 | .info = alc_ch_mode_info, |
| 3628 | .get = alc_ch_mode_get, |
| 3629 | .put = alc_ch_mode_put, |
| 3630 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3631 | { } /* end */ |
| 3632 | }; |
| 3633 | |
| 3634 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3635 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3636 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3637 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3638 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3639 | /* set capture source to mic-in */ |
| 3640 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3641 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3642 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3643 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3644 | /* speaker-out */ |
| 3645 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3646 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3647 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3648 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3649 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3650 | /* mic-in to input */ |
| 3651 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3652 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3653 | /* built-in mic */ |
| 3654 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3655 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3656 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3657 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3658 | { } |
| 3659 | }; |
| 3660 | |
| 3661 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3662 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3663 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3664 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3665 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3666 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3667 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3668 | } |
| 3669 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3670 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3671 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3672 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3675 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3676 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3677 | { } /* end */ |
| 3678 | }; |
| 3679 | |
| 3680 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3681 | .num_items = 2, |
| 3682 | .items = { |
| 3683 | { "Mic", 0x0 }, |
| 3684 | { "Internal Mic", 0x1 }, |
| 3685 | }, |
| 3686 | }; |
| 3687 | |
| 3688 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3689 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3690 | |
| 3691 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3692 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3693 | |
| 3694 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3695 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3696 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3697 | /* Mic2 (as headphone out) for HP output */ |
| 3698 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3699 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3700 | /* Internal Speaker */ |
| 3701 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3702 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3703 | |
| 3704 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3705 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3706 | |
| 3707 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3708 | { } |
| 3709 | }; |
| 3710 | |
| 3711 | /* toggle speaker-output according to the hp-jack state */ |
| 3712 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3713 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3714 | struct alc_spec *spec = codec->spec; |
| 3715 | alc_automute_amp(codec); |
| 3716 | /* toggle EAPD */ |
| 3717 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3718 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3719 | else |
| 3720 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3721 | } |
| 3722 | |
| 3723 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3724 | unsigned int res) |
| 3725 | { |
| 3726 | /* Looks like the unsol event is incompatible with the standard |
| 3727 | * definition. 4bit tag is placed at 28 bit! |
| 3728 | */ |
| 3729 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3730 | alc880_medion_rim_automute(codec); |
| 3731 | } |
| 3732 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3733 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3734 | { |
| 3735 | struct alc_spec *spec = codec->spec; |
| 3736 | |
| 3737 | spec->autocfg.hp_pins[0] = 0x14; |
| 3738 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3739 | } |
| 3740 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3741 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3742 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3743 | { 0x0b, HDA_INPUT, 0 }, |
| 3744 | { 0x0b, HDA_INPUT, 1 }, |
| 3745 | { 0x0b, HDA_INPUT, 2 }, |
| 3746 | { 0x0b, HDA_INPUT, 3 }, |
| 3747 | { 0x0b, HDA_INPUT, 4 }, |
| 3748 | { } /* end */ |
| 3749 | }; |
| 3750 | |
| 3751 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3752 | { 0x0b, HDA_INPUT, 1 }, |
| 3753 | { 0x0b, HDA_INPUT, 6 }, |
| 3754 | { 0x0b, HDA_INPUT, 7 }, |
| 3755 | { } /* end */ |
| 3756 | }; |
| 3757 | #endif |
| 3758 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3759 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3760 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3761 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3762 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3763 | static int alc_init(struct hda_codec *codec) |
| 3764 | { |
| 3765 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3766 | unsigned int i; |
| 3767 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3768 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3769 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3770 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3771 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3772 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3773 | |
| 3774 | if (spec->init_hook) |
| 3775 | spec->init_hook(codec); |
| 3776 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3777 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3778 | return 0; |
| 3779 | } |
| 3780 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3781 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3782 | { |
| 3783 | struct alc_spec *spec = codec->spec; |
| 3784 | |
| 3785 | if (spec->unsol_event) |
| 3786 | spec->unsol_event(codec, res); |
| 3787 | } |
| 3788 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3789 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3790 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3791 | { |
| 3792 | struct alc_spec *spec = codec->spec; |
| 3793 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3794 | } |
| 3795 | #endif |
| 3796 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3797 | /* |
| 3798 | * Analog playback callbacks |
| 3799 | */ |
| 3800 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3801 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3802 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3803 | { |
| 3804 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3805 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3806 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3807 | } |
| 3808 | |
| 3809 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3810 | struct hda_codec *codec, |
| 3811 | unsigned int stream_tag, |
| 3812 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3813 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3814 | { |
| 3815 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3816 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3817 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3818 | } |
| 3819 | |
| 3820 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3821 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3822 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3823 | { |
| 3824 | struct alc_spec *spec = codec->spec; |
| 3825 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3826 | } |
| 3827 | |
| 3828 | /* |
| 3829 | * Digital out |
| 3830 | */ |
| 3831 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3832 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3833 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3834 | { |
| 3835 | struct alc_spec *spec = codec->spec; |
| 3836 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3837 | } |
| 3838 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3839 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3840 | struct hda_codec *codec, |
| 3841 | unsigned int stream_tag, |
| 3842 | unsigned int format, |
| 3843 | struct snd_pcm_substream *substream) |
| 3844 | { |
| 3845 | struct alc_spec *spec = codec->spec; |
| 3846 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3847 | stream_tag, format, substream); |
| 3848 | } |
| 3849 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3850 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3851 | struct hda_codec *codec, |
| 3852 | struct snd_pcm_substream *substream) |
| 3853 | { |
| 3854 | struct alc_spec *spec = codec->spec; |
| 3855 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3856 | } |
| 3857 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3858 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3859 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3860 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3861 | { |
| 3862 | struct alc_spec *spec = codec->spec; |
| 3863 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3864 | } |
| 3865 | |
| 3866 | /* |
| 3867 | * Analog capture |
| 3868 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3869 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3870 | struct hda_codec *codec, |
| 3871 | unsigned int stream_tag, |
| 3872 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3873 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3874 | { |
| 3875 | struct alc_spec *spec = codec->spec; |
| 3876 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3877 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3878 | stream_tag, 0, format); |
| 3879 | return 0; |
| 3880 | } |
| 3881 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3882 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3883 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3884 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3885 | { |
| 3886 | struct alc_spec *spec = codec->spec; |
| 3887 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3888 | snd_hda_codec_cleanup_stream(codec, |
| 3889 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3890 | return 0; |
| 3891 | } |
| 3892 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3893 | /* analog capture with dynamic dual-adc changes */ |
| 3894 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3895 | struct hda_codec *codec, |
| 3896 | unsigned int stream_tag, |
| 3897 | unsigned int format, |
| 3898 | struct snd_pcm_substream *substream) |
| 3899 | { |
| 3900 | struct alc_spec *spec = codec->spec; |
| 3901 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3902 | spec->cur_adc_stream_tag = stream_tag; |
| 3903 | spec->cur_adc_format = format; |
| 3904 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3905 | return 0; |
| 3906 | } |
| 3907 | |
| 3908 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3909 | struct hda_codec *codec, |
| 3910 | struct snd_pcm_substream *substream) |
| 3911 | { |
| 3912 | struct alc_spec *spec = codec->spec; |
| 3913 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 3914 | spec->cur_adc = 0; |
| 3915 | return 0; |
| 3916 | } |
| 3917 | |
| 3918 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 3919 | .substreams = 1, |
| 3920 | .channels_min = 2, |
| 3921 | .channels_max = 2, |
| 3922 | .nid = 0, /* fill later */ |
| 3923 | .ops = { |
| 3924 | .prepare = dualmic_capture_pcm_prepare, |
| 3925 | .cleanup = dualmic_capture_pcm_cleanup |
| 3926 | }, |
| 3927 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3928 | |
| 3929 | /* |
| 3930 | */ |
| 3931 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3932 | .substreams = 1, |
| 3933 | .channels_min = 2, |
| 3934 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3935 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3936 | .ops = { |
| 3937 | .open = alc880_playback_pcm_open, |
| 3938 | .prepare = alc880_playback_pcm_prepare, |
| 3939 | .cleanup = alc880_playback_pcm_cleanup |
| 3940 | }, |
| 3941 | }; |
| 3942 | |
| 3943 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3944 | .substreams = 1, |
| 3945 | .channels_min = 2, |
| 3946 | .channels_max = 2, |
| 3947 | /* NID is set in alc_build_pcms */ |
| 3948 | }; |
| 3949 | |
| 3950 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3951 | .substreams = 1, |
| 3952 | .channels_min = 2, |
| 3953 | .channels_max = 2, |
| 3954 | /* NID is set in alc_build_pcms */ |
| 3955 | }; |
| 3956 | |
| 3957 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3958 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3959 | .channels_min = 2, |
| 3960 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3961 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3962 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3963 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3964 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3965 | }, |
| 3966 | }; |
| 3967 | |
| 3968 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3969 | .substreams = 1, |
| 3970 | .channels_min = 2, |
| 3971 | .channels_max = 2, |
| 3972 | /* NID is set in alc_build_pcms */ |
| 3973 | .ops = { |
| 3974 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3975 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3976 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3977 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3978 | }, |
| 3979 | }; |
| 3980 | |
| 3981 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3982 | .substreams = 1, |
| 3983 | .channels_min = 2, |
| 3984 | .channels_max = 2, |
| 3985 | /* NID is set in alc_build_pcms */ |
| 3986 | }; |
| 3987 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3988 | /* 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] | 3989 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3990 | .substreams = 0, |
| 3991 | .channels_min = 0, |
| 3992 | .channels_max = 0, |
| 3993 | }; |
| 3994 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3995 | static int alc_build_pcms(struct hda_codec *codec) |
| 3996 | { |
| 3997 | struct alc_spec *spec = codec->spec; |
| 3998 | struct hda_pcm *info = spec->pcm_rec; |
| 3999 | int i; |
| 4000 | |
| 4001 | codec->num_pcms = 1; |
| 4002 | codec->pcm_info = info; |
| 4003 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4004 | if (spec->no_analog) |
| 4005 | goto skip_analog; |
| 4006 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4007 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4008 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4009 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4010 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4011 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4012 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4013 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4014 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4015 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4016 | } |
| 4017 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4018 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4019 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4020 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4021 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4022 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4023 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4024 | if (spec->channel_mode) { |
| 4025 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4026 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4027 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4028 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4029 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4030 | } |
| 4031 | } |
| 4032 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4033 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4034 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4035 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4036 | snprintf(spec->stream_name_digital, |
| 4037 | sizeof(spec->stream_name_digital), |
| 4038 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4039 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4040 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4041 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4042 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4043 | if (spec->dig_out_type) |
| 4044 | info->pcm_type = spec->dig_out_type; |
| 4045 | else |
| 4046 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4047 | if (spec->multiout.dig_out_nid && |
| 4048 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4049 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4050 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4051 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4052 | if (spec->dig_in_nid && |
| 4053 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4054 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4055 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4056 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4057 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4058 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4059 | } |
| 4060 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4061 | if (spec->no_analog) |
| 4062 | return 0; |
| 4063 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4064 | /* If the use of more than one ADC is requested for the current |
| 4065 | * model, configure a second analog capture-only PCM. |
| 4066 | */ |
| 4067 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4068 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4069 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4070 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4071 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4072 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4073 | if (spec->alt_dac_nid) { |
| 4074 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4075 | *spec->stream_analog_alt_playback; |
| 4076 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4077 | spec->alt_dac_nid; |
| 4078 | } else { |
| 4079 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4080 | alc_pcm_null_stream; |
| 4081 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4082 | } |
| 4083 | if (spec->num_adc_nids > 1) { |
| 4084 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4085 | *spec->stream_analog_alt_capture; |
| 4086 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4087 | spec->adc_nids[1]; |
| 4088 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4089 | spec->num_adc_nids - 1; |
| 4090 | } else { |
| 4091 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4092 | alc_pcm_null_stream; |
| 4093 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4094 | } |
| 4095 | } |
| 4096 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4097 | return 0; |
| 4098 | } |
| 4099 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4100 | static inline void alc_shutup(struct hda_codec *codec) |
| 4101 | { |
| 4102 | snd_hda_shutup_pins(codec); |
| 4103 | } |
| 4104 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4105 | static void alc_free_kctls(struct hda_codec *codec) |
| 4106 | { |
| 4107 | struct alc_spec *spec = codec->spec; |
| 4108 | |
| 4109 | if (spec->kctls.list) { |
| 4110 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4111 | int i; |
| 4112 | for (i = 0; i < spec->kctls.used; i++) |
| 4113 | kfree(kctl[i].name); |
| 4114 | } |
| 4115 | snd_array_free(&spec->kctls); |
| 4116 | } |
| 4117 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4118 | static void alc_free(struct hda_codec *codec) |
| 4119 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4120 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4121 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4122 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4123 | return; |
| 4124 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4125 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4126 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4127 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4128 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4129 | } |
| 4130 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4131 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4132 | static void alc_power_eapd(struct hda_codec *codec) |
| 4133 | { |
| 4134 | /* We currently only handle front, HP */ |
| 4135 | switch (codec->vendor_id) { |
| 4136 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4137 | set_eapd(codec, 0x0f, 0); |
| 4138 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4139 | break; |
| 4140 | case 0x10ec0262: |
| 4141 | case 0x10ec0267: |
| 4142 | case 0x10ec0268: |
| 4143 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4144 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4145 | case 0x10ec0272: |
| 4146 | case 0x10ec0660: |
| 4147 | case 0x10ec0662: |
| 4148 | case 0x10ec0663: |
| 4149 | case 0x10ec0862: |
| 4150 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4151 | set_eapd(codec, 0x14, 0); |
| 4152 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4153 | break; |
| 4154 | } |
| 4155 | } |
| 4156 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4157 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4158 | { |
| 4159 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4160 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4161 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4162 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4163 | return 0; |
| 4164 | } |
| 4165 | #endif |
| 4166 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4167 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4168 | static int alc_resume(struct hda_codec *codec) |
| 4169 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4170 | codec->patch_ops.init(codec); |
| 4171 | snd_hda_codec_resume_amp(codec); |
| 4172 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4173 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4174 | return 0; |
| 4175 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4176 | #endif |
| 4177 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4178 | /* |
| 4179 | */ |
| 4180 | static struct hda_codec_ops alc_patch_ops = { |
| 4181 | .build_controls = alc_build_controls, |
| 4182 | .build_pcms = alc_build_pcms, |
| 4183 | .init = alc_init, |
| 4184 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4185 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4186 | #ifdef SND_HDA_NEEDS_RESUME |
| 4187 | .resume = alc_resume, |
| 4188 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4189 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4190 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4191 | .check_power_status = alc_check_power_status, |
| 4192 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4193 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4194 | }; |
| 4195 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4196 | /* replace the codec chip_name with the given string */ |
| 4197 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4198 | { |
| 4199 | kfree(codec->chip_name); |
| 4200 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4201 | if (!codec->chip_name) { |
| 4202 | alc_free(codec); |
| 4203 | return -ENOMEM; |
| 4204 | } |
| 4205 | return 0; |
| 4206 | } |
| 4207 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4208 | /* |
| 4209 | * Test configuration for debugging |
| 4210 | * |
| 4211 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4212 | * enum controls. |
| 4213 | */ |
| 4214 | #ifdef CONFIG_SND_DEBUG |
| 4215 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4216 | 0x02, 0x03, 0x04, 0x05 |
| 4217 | }; |
| 4218 | |
| 4219 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4220 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4221 | .items = { |
| 4222 | { "In-1", 0x0 }, |
| 4223 | { "In-2", 0x1 }, |
| 4224 | { "In-3", 0x2 }, |
| 4225 | { "In-4", 0x3 }, |
| 4226 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4227 | { "Front", 0x5 }, |
| 4228 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4229 | }, |
| 4230 | }; |
| 4231 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4232 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4233 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4234 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4235 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4236 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4237 | }; |
| 4238 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4239 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4240 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4241 | { |
| 4242 | static char *texts[] = { |
| 4243 | "N/A", "Line Out", "HP Out", |
| 4244 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4245 | }; |
| 4246 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4247 | uinfo->count = 1; |
| 4248 | uinfo->value.enumerated.items = 8; |
| 4249 | if (uinfo->value.enumerated.item >= 8) |
| 4250 | uinfo->value.enumerated.item = 7; |
| 4251 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4252 | return 0; |
| 4253 | } |
| 4254 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4255 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4256 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4257 | { |
| 4258 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4259 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4260 | unsigned int pin_ctl, item = 0; |
| 4261 | |
| 4262 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4263 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4264 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4265 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4266 | item = 2; |
| 4267 | else |
| 4268 | item = 1; |
| 4269 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4270 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4271 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4272 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4273 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4274 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4275 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4276 | } |
| 4277 | } |
| 4278 | ucontrol->value.enumerated.item[0] = item; |
| 4279 | return 0; |
| 4280 | } |
| 4281 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4282 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4283 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4284 | { |
| 4285 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4286 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4287 | static unsigned int ctls[] = { |
| 4288 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4289 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4290 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4291 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4292 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4293 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4294 | }; |
| 4295 | unsigned int old_ctl, new_ctl; |
| 4296 | |
| 4297 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4298 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4299 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4300 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4301 | int val; |
| 4302 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4303 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4304 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4305 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4306 | HDA_AMP_MUTE : 0; |
| 4307 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4308 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4309 | return 1; |
| 4310 | } |
| 4311 | return 0; |
| 4312 | } |
| 4313 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4314 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4315 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4316 | { |
| 4317 | static char *texts[] = { |
| 4318 | "Front", "Surround", "CLFE", "Side" |
| 4319 | }; |
| 4320 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4321 | uinfo->count = 1; |
| 4322 | uinfo->value.enumerated.items = 4; |
| 4323 | if (uinfo->value.enumerated.item >= 4) |
| 4324 | uinfo->value.enumerated.item = 3; |
| 4325 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4326 | return 0; |
| 4327 | } |
| 4328 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4329 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4330 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4331 | { |
| 4332 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4333 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4334 | unsigned int sel; |
| 4335 | |
| 4336 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4337 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4338 | return 0; |
| 4339 | } |
| 4340 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4341 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4342 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4343 | { |
| 4344 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4345 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4346 | unsigned int sel; |
| 4347 | |
| 4348 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4349 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4350 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4351 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4352 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4353 | return 1; |
| 4354 | } |
| 4355 | return 0; |
| 4356 | } |
| 4357 | |
| 4358 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4359 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4360 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4361 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4362 | .info = alc_test_pin_ctl_info, \ |
| 4363 | .get = alc_test_pin_ctl_get, \ |
| 4364 | .put = alc_test_pin_ctl_put, \ |
| 4365 | .private_value = nid \ |
| 4366 | } |
| 4367 | |
| 4368 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4369 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4370 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4371 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4372 | .info = alc_test_pin_src_info, \ |
| 4373 | .get = alc_test_pin_src_get, \ |
| 4374 | .put = alc_test_pin_src_put, \ |
| 4375 | .private_value = nid \ |
| 4376 | } |
| 4377 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4378 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4379 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4380 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4381 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4382 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4383 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4384 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4385 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4386 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4387 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4388 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4389 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4390 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4391 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4392 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4393 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4394 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4395 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4396 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4397 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4398 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4399 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4400 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4401 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4402 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4403 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4404 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4405 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4406 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4407 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4408 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4409 | { |
| 4410 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4411 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4412 | .info = alc_ch_mode_info, |
| 4413 | .get = alc_ch_mode_get, |
| 4414 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4415 | }, |
| 4416 | { } /* end */ |
| 4417 | }; |
| 4418 | |
| 4419 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4420 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4421 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4422 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4423 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4424 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4425 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4426 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4427 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4428 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4429 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4431 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4432 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4433 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4434 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4435 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4436 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4437 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4438 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4439 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4440 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4441 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4442 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4443 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4444 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4445 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4446 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4447 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4448 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4449 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4450 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4451 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4452 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4453 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4454 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4455 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4457 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4458 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4459 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4460 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4461 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4462 | /* Analog input/passthru */ |
| 4463 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4464 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4465 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4466 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4467 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4468 | { } |
| 4469 | }; |
| 4470 | #endif |
| 4471 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4472 | /* |
| 4473 | */ |
| 4474 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4475 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4476 | [ALC880_3ST] = "3stack", |
| 4477 | [ALC880_TCL_S700] = "tcl", |
| 4478 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4479 | [ALC880_CLEVO] = "clevo", |
| 4480 | [ALC880_5ST] = "5stack", |
| 4481 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4482 | [ALC880_W810] = "w810", |
| 4483 | [ALC880_Z71V] = "z71v", |
| 4484 | [ALC880_6ST] = "6stack", |
| 4485 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4486 | [ALC880_ASUS] = "asus", |
| 4487 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4488 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4489 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4490 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4491 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4492 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4493 | [ALC880_F1734] = "F1734", |
| 4494 | [ALC880_LG] = "lg", |
| 4495 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4496 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4497 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4498 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4499 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4500 | [ALC880_AUTO] = "auto", |
| 4501 | }; |
| 4502 | |
| 4503 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4504 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4505 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4506 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4507 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4508 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4509 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4510 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4511 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4512 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4513 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4514 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4515 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4516 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4517 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4518 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4519 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4520 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4521 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4522 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4523 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4524 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4525 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4526 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4527 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4528 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4529 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4530 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4531 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4532 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4533 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4534 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4535 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4536 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4537 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4538 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4539 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4540 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4541 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4542 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4543 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4544 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4545 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4546 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4547 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4548 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4549 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4550 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4551 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4552 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4553 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4554 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4555 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4556 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4557 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4558 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4559 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4560 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4561 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4562 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4563 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4564 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4565 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4566 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4567 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4568 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4569 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4570 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4571 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4572 | /* default Intel */ |
| 4573 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4574 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4575 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4576 | {} |
| 4577 | }; |
| 4578 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4579 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4580 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4581 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4582 | static struct alc_config_preset alc880_presets[] = { |
| 4583 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4584 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4585 | .init_verbs = { alc880_volume_init_verbs, |
| 4586 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4587 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4588 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4589 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4590 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4591 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4592 | .input_mux = &alc880_capture_source, |
| 4593 | }, |
| 4594 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4595 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4596 | .init_verbs = { alc880_volume_init_verbs, |
| 4597 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4598 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4599 | .dac_nids = alc880_dac_nids, |
| 4600 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4601 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4602 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4603 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4604 | .input_mux = &alc880_capture_source, |
| 4605 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4606 | [ALC880_TCL_S700] = { |
| 4607 | .mixers = { alc880_tcl_s700_mixer }, |
| 4608 | .init_verbs = { alc880_volume_init_verbs, |
| 4609 | alc880_pin_tcl_S700_init_verbs, |
| 4610 | alc880_gpio2_init_verbs }, |
| 4611 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4612 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4613 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4614 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4615 | .hp_nid = 0x03, |
| 4616 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4617 | .channel_mode = alc880_2_jack_modes, |
| 4618 | .input_mux = &alc880_capture_source, |
| 4619 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4620 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4621 | .mixers = { alc880_three_stack_mixer, |
| 4622 | alc880_five_stack_mixer}, |
| 4623 | .init_verbs = { alc880_volume_init_verbs, |
| 4624 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4625 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4626 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4627 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4628 | .channel_mode = alc880_fivestack_modes, |
| 4629 | .input_mux = &alc880_capture_source, |
| 4630 | }, |
| 4631 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4632 | .mixers = { alc880_three_stack_mixer, |
| 4633 | alc880_five_stack_mixer }, |
| 4634 | .init_verbs = { alc880_volume_init_verbs, |
| 4635 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4636 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4637 | .dac_nids = alc880_dac_nids, |
| 4638 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4639 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4640 | .channel_mode = alc880_fivestack_modes, |
| 4641 | .input_mux = &alc880_capture_source, |
| 4642 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4643 | [ALC880_6ST] = { |
| 4644 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4645 | .init_verbs = { alc880_volume_init_verbs, |
| 4646 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4647 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4648 | .dac_nids = alc880_6st_dac_nids, |
| 4649 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4650 | .channel_mode = alc880_sixstack_modes, |
| 4651 | .input_mux = &alc880_6stack_capture_source, |
| 4652 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4653 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4654 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4655 | .init_verbs = { alc880_volume_init_verbs, |
| 4656 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4657 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4658 | .dac_nids = alc880_6st_dac_nids, |
| 4659 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4660 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4661 | .channel_mode = alc880_sixstack_modes, |
| 4662 | .input_mux = &alc880_6stack_capture_source, |
| 4663 | }, |
| 4664 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4665 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4666 | .init_verbs = { alc880_volume_init_verbs, |
| 4667 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4668 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4669 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4670 | .dac_nids = alc880_w810_dac_nids, |
| 4671 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4672 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4673 | .channel_mode = alc880_w810_modes, |
| 4674 | .input_mux = &alc880_capture_source, |
| 4675 | }, |
| 4676 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4677 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4678 | .init_verbs = { alc880_volume_init_verbs, |
| 4679 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4680 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4681 | .dac_nids = alc880_z71v_dac_nids, |
| 4682 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4683 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4684 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4685 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4686 | .input_mux = &alc880_capture_source, |
| 4687 | }, |
| 4688 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4689 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4690 | .init_verbs = { alc880_volume_init_verbs, |
| 4691 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4692 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4693 | .dac_nids = alc880_f1734_dac_nids, |
| 4694 | .hp_nid = 0x02, |
| 4695 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4696 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4697 | .input_mux = &alc880_f1734_capture_source, |
| 4698 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4699 | .setup = alc880_uniwill_p53_setup, |
| 4700 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4701 | }, |
| 4702 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4703 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4704 | .init_verbs = { alc880_volume_init_verbs, |
| 4705 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4706 | alc880_gpio1_init_verbs }, |
| 4707 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4708 | .dac_nids = alc880_asus_dac_nids, |
| 4709 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4710 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4711 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4712 | .input_mux = &alc880_capture_source, |
| 4713 | }, |
| 4714 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4715 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4716 | .init_verbs = { alc880_volume_init_verbs, |
| 4717 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4718 | alc880_gpio1_init_verbs }, |
| 4719 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4720 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4721 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4722 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4723 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4724 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4725 | .input_mux = &alc880_capture_source, |
| 4726 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4727 | [ALC880_ASUS_DIG2] = { |
| 4728 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4729 | .init_verbs = { alc880_volume_init_verbs, |
| 4730 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4731 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4732 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4733 | .dac_nids = alc880_asus_dac_nids, |
| 4734 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4735 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4736 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4737 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4738 | .input_mux = &alc880_capture_source, |
| 4739 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4740 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4741 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4742 | .init_verbs = { alc880_volume_init_verbs, |
| 4743 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4744 | alc880_gpio1_init_verbs }, |
| 4745 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4746 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4747 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4748 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4749 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4750 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4751 | .input_mux = &alc880_capture_source, |
| 4752 | }, |
| 4753 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4754 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4755 | .init_verbs = { alc880_volume_init_verbs, |
| 4756 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4757 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4758 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4759 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4760 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4761 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4762 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4763 | .input_mux = &alc880_capture_source, |
| 4764 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4765 | [ALC880_UNIWILL] = { |
| 4766 | .mixers = { alc880_uniwill_mixer }, |
| 4767 | .init_verbs = { alc880_volume_init_verbs, |
| 4768 | alc880_uniwill_init_verbs }, |
| 4769 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4770 | .dac_nids = alc880_asus_dac_nids, |
| 4771 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4772 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4773 | .channel_mode = alc880_threestack_modes, |
| 4774 | .need_dac_fix = 1, |
| 4775 | .input_mux = &alc880_capture_source, |
| 4776 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4777 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4778 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4779 | }, |
| 4780 | [ALC880_UNIWILL_P53] = { |
| 4781 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4782 | .init_verbs = { alc880_volume_init_verbs, |
| 4783 | alc880_uniwill_p53_init_verbs }, |
| 4784 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4785 | .dac_nids = alc880_asus_dac_nids, |
| 4786 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4787 | .channel_mode = alc880_threestack_modes, |
| 4788 | .input_mux = &alc880_capture_source, |
| 4789 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4790 | .setup = alc880_uniwill_p53_setup, |
| 4791 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4792 | }, |
| 4793 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4794 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4795 | .init_verbs = { alc880_volume_init_verbs, |
| 4796 | alc880_uniwill_p53_init_verbs, |
| 4797 | alc880_beep_init_verbs }, |
| 4798 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4799 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4800 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4801 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4802 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4803 | .input_mux = &alc880_capture_source, |
| 4804 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4805 | .setup = alc880_uniwill_p53_setup, |
| 4806 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4807 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4808 | [ALC880_CLEVO] = { |
| 4809 | .mixers = { alc880_three_stack_mixer }, |
| 4810 | .init_verbs = { alc880_volume_init_verbs, |
| 4811 | alc880_pin_clevo_init_verbs }, |
| 4812 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4813 | .dac_nids = alc880_dac_nids, |
| 4814 | .hp_nid = 0x03, |
| 4815 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4816 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4817 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4818 | .input_mux = &alc880_capture_source, |
| 4819 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4820 | [ALC880_LG] = { |
| 4821 | .mixers = { alc880_lg_mixer }, |
| 4822 | .init_verbs = { alc880_volume_init_verbs, |
| 4823 | alc880_lg_init_verbs }, |
| 4824 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4825 | .dac_nids = alc880_lg_dac_nids, |
| 4826 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4827 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4828 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4829 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4830 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4831 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4832 | .setup = alc880_lg_setup, |
| 4833 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4834 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4835 | .loopbacks = alc880_lg_loopbacks, |
| 4836 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4837 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4838 | [ALC880_LG_LW] = { |
| 4839 | .mixers = { alc880_lg_lw_mixer }, |
| 4840 | .init_verbs = { alc880_volume_init_verbs, |
| 4841 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4842 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4843 | .dac_nids = alc880_dac_nids, |
| 4844 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4845 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4846 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4847 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4848 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4849 | .setup = alc880_lg_lw_setup, |
| 4850 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4851 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4852 | [ALC880_MEDION_RIM] = { |
| 4853 | .mixers = { alc880_medion_rim_mixer }, |
| 4854 | .init_verbs = { alc880_volume_init_verbs, |
| 4855 | alc880_medion_rim_init_verbs, |
| 4856 | alc_gpio2_init_verbs }, |
| 4857 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4858 | .dac_nids = alc880_dac_nids, |
| 4859 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4860 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4861 | .channel_mode = alc880_2_jack_modes, |
| 4862 | .input_mux = &alc880_medion_rim_capture_source, |
| 4863 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4864 | .setup = alc880_medion_rim_setup, |
| 4865 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4866 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4867 | #ifdef CONFIG_SND_DEBUG |
| 4868 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4869 | .mixers = { alc880_test_mixer }, |
| 4870 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4871 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4872 | .dac_nids = alc880_test_dac_nids, |
| 4873 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4874 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4875 | .channel_mode = alc880_test_modes, |
| 4876 | .input_mux = &alc880_test_capture_source, |
| 4877 | }, |
| 4878 | #endif |
| 4879 | }; |
| 4880 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4881 | /* |
| 4882 | * Automatic parse of I/O pins from the BIOS configuration |
| 4883 | */ |
| 4884 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4885 | enum { |
| 4886 | ALC_CTL_WIDGET_VOL, |
| 4887 | ALC_CTL_WIDGET_MUTE, |
| 4888 | ALC_CTL_BIND_MUTE, |
| 4889 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4890 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4891 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4892 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4893 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4894 | }; |
| 4895 | |
| 4896 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4897 | 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] | 4898 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4899 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4900 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4901 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4902 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4903 | knew = snd_array_new(&spec->kctls); |
| 4904 | if (!knew) |
| 4905 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4906 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4907 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4908 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4909 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4910 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4911 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4912 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4913 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4914 | return 0; |
| 4915 | } |
| 4916 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4917 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4918 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4919 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4920 | { |
| 4921 | char name[32]; |
| 4922 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4923 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4924 | } |
| 4925 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4926 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4927 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 4928 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4929 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 4930 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 4931 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 4932 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 4933 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4934 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4935 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4936 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4937 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4938 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4939 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4940 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4941 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4942 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4943 | #define ALC880_PIN_CD_NID 0x1c |
| 4944 | |
| 4945 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4946 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4947 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4948 | { |
| 4949 | hda_nid_t nid; |
| 4950 | int assigned[4]; |
| 4951 | int i, j; |
| 4952 | |
| 4953 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4954 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4955 | |
| 4956 | /* check the pins hardwired to audio widget */ |
| 4957 | for (i = 0; i < cfg->line_outs; i++) { |
| 4958 | nid = cfg->line_out_pins[i]; |
| 4959 | if (alc880_is_fixed_pin(nid)) { |
| 4960 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4961 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4962 | assigned[idx] = 1; |
| 4963 | } |
| 4964 | } |
| 4965 | /* left pins can be connect to any audio widget */ |
| 4966 | for (i = 0; i < cfg->line_outs; i++) { |
| 4967 | nid = cfg->line_out_pins[i]; |
| 4968 | if (alc880_is_fixed_pin(nid)) |
| 4969 | continue; |
| 4970 | /* search for an empty channel */ |
| 4971 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4972 | if (!assigned[j]) { |
| 4973 | spec->multiout.dac_nids[i] = |
| 4974 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4975 | assigned[j] = 1; |
| 4976 | break; |
| 4977 | } |
| 4978 | } |
| 4979 | } |
| 4980 | spec->multiout.num_dacs = cfg->line_outs; |
| 4981 | return 0; |
| 4982 | } |
| 4983 | |
| 4984 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4985 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4986 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4987 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4988 | static const char *chname[4] = { |
| 4989 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4990 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4991 | hda_nid_t nid; |
| 4992 | int i, err; |
| 4993 | |
| 4994 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4995 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4996 | continue; |
| 4997 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4998 | if (i == 2) { |
| 4999 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5000 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5001 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5002 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5003 | HDA_OUTPUT)); |
| 5004 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5005 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5006 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5007 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5008 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5009 | HDA_OUTPUT)); |
| 5010 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5011 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5012 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5013 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5014 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5015 | HDA_INPUT)); |
| 5016 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5017 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5018 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5019 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5020 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5021 | HDA_INPUT)); |
| 5022 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5023 | return err; |
| 5024 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 5025 | const char *pfx; |
| 5026 | if (cfg->line_outs == 1 && |
| 5027 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 5028 | pfx = "Speaker"; |
| 5029 | else |
| 5030 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5031 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5032 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5033 | HDA_OUTPUT)); |
| 5034 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5035 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5036 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5037 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5038 | HDA_INPUT)); |
| 5039 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5040 | return err; |
| 5041 | } |
| 5042 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5043 | return 0; |
| 5044 | } |
| 5045 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5046 | /* add playback controls for speaker and HP outputs */ |
| 5047 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5048 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5049 | { |
| 5050 | hda_nid_t nid; |
| 5051 | int err; |
| 5052 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5053 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5054 | return 0; |
| 5055 | |
| 5056 | if (alc880_is_fixed_pin(pin)) { |
| 5057 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5058 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5059 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5060 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5061 | else |
| 5062 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5063 | /* control HP volume/switch on the output mixer amp */ |
| 5064 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5065 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5066 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5067 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5068 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5069 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5070 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5071 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5072 | return err; |
| 5073 | } else if (alc880_is_multi_pin(pin)) { |
| 5074 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5075 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5076 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5077 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5078 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5079 | return err; |
| 5080 | } |
| 5081 | return 0; |
| 5082 | } |
| 5083 | |
| 5084 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5085 | 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] | 5086 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5087 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5088 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5089 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5090 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5091 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5092 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5093 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5094 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5095 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5096 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5097 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5098 | return err; |
| 5099 | return 0; |
| 5100 | } |
| 5101 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5102 | 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] | 5103 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5104 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5105 | return (pincap & AC_PINCAP_IN) != 0; |
| 5106 | } |
| 5107 | |
| 5108 | /* create playback/capture controls for input pins */ |
| 5109 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5110 | const struct auto_pin_cfg *cfg, |
| 5111 | hda_nid_t mixer, |
| 5112 | hda_nid_t cap1, hda_nid_t cap2) |
| 5113 | { |
| 5114 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5115 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5116 | int i, err, idx, type, type_idx = 0; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5117 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5118 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5119 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5120 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5121 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5122 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5123 | if (!alc_is_input_pin(codec, pin)) |
| 5124 | continue; |
| 5125 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5126 | type = cfg->inputs[i].type; |
| 5127 | if (i > 0 && type == cfg->inputs[i - 1].type) |
| 5128 | type_idx++; |
| 5129 | else |
| 5130 | type_idx = 0; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5131 | label = hda_get_autocfg_input_label(codec, cfg, i); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5132 | if (mixer) { |
| 5133 | idx = get_connection_index(codec, mixer, pin); |
| 5134 | if (idx >= 0) { |
| 5135 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5136 | label, type_idx, |
| 5137 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5138 | if (err < 0) |
| 5139 | return err; |
| 5140 | } |
| 5141 | } |
| 5142 | |
| 5143 | if (!cap1) |
| 5144 | continue; |
| 5145 | idx = get_connection_index(codec, cap1, pin); |
| 5146 | if (idx < 0 && cap2) |
| 5147 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5148 | if (idx >= 0) |
| 5149 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5150 | } |
| 5151 | return 0; |
| 5152 | } |
| 5153 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5154 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5155 | const struct auto_pin_cfg *cfg) |
| 5156 | { |
| 5157 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5158 | } |
| 5159 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5160 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5161 | unsigned int pin_type) |
| 5162 | { |
| 5163 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5164 | pin_type); |
| 5165 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5166 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5167 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5168 | } |
| 5169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5170 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5171 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5172 | int dac_idx) |
| 5173 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5174 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5175 | /* need the manual connection? */ |
| 5176 | if (alc880_is_multi_pin(nid)) { |
| 5177 | struct alc_spec *spec = codec->spec; |
| 5178 | int idx = alc880_multi_pin_idx(nid); |
| 5179 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5180 | AC_VERB_SET_CONNECT_SEL, |
| 5181 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5182 | } |
| 5183 | } |
| 5184 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5185 | static int get_pin_type(int line_out_type) |
| 5186 | { |
| 5187 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5188 | return PIN_HP; |
| 5189 | else |
| 5190 | return PIN_OUT; |
| 5191 | } |
| 5192 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5193 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5194 | { |
| 5195 | struct alc_spec *spec = codec->spec; |
| 5196 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5197 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5198 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5199 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5200 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5201 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5202 | } |
| 5203 | } |
| 5204 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5205 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5206 | { |
| 5207 | struct alc_spec *spec = codec->spec; |
| 5208 | hda_nid_t pin; |
| 5209 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5210 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5211 | if (pin) /* connect to front */ |
| 5212 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5213 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5214 | if (pin) /* connect to front */ |
| 5215 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5216 | } |
| 5217 | |
| 5218 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5219 | { |
| 5220 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5221 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5222 | int i; |
| 5223 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5224 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5225 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5226 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5227 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5228 | if (nid != ALC880_PIN_CD_NID && |
| 5229 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5230 | snd_hda_codec_write(codec, nid, 0, |
| 5231 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5232 | AMP_OUT_MUTE); |
| 5233 | } |
| 5234 | } |
| 5235 | } |
| 5236 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5237 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5238 | { |
| 5239 | struct alc_spec *spec = codec->spec; |
| 5240 | int c; |
| 5241 | |
| 5242 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5243 | unsigned int mux_idx; |
| 5244 | const struct hda_input_mux *imux; |
| 5245 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5246 | imux = &spec->input_mux[mux_idx]; |
| 5247 | if (!imux->num_items && mux_idx > 0) |
| 5248 | imux = &spec->input_mux[0]; |
| 5249 | if (imux) |
| 5250 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5251 | AC_VERB_SET_CONNECT_SEL, |
| 5252 | imux->items[0].index); |
| 5253 | } |
| 5254 | } |
| 5255 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5256 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5257 | /* return 1 if successful, 0 if the proper config is not found, |
| 5258 | * or a negative error code |
| 5259 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5260 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5261 | { |
| 5262 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5263 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5264 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5265 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5266 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5267 | alc880_ignore); |
| 5268 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5269 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5270 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5271 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5272 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5273 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5274 | if (err < 0) |
| 5275 | return err; |
| 5276 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5277 | if (err < 0) |
| 5278 | return err; |
| 5279 | err = alc880_auto_create_extra_out(spec, |
| 5280 | spec->autocfg.speaker_pins[0], |
| 5281 | "Speaker"); |
| 5282 | if (err < 0) |
| 5283 | return err; |
| 5284 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5285 | "Headphone"); |
| 5286 | if (err < 0) |
| 5287 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5288 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5289 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5290 | return err; |
| 5291 | |
| 5292 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5293 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5294 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5295 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5296 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5297 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5298 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5299 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5300 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5301 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5302 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5303 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5304 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5305 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5306 | return 1; |
| 5307 | } |
| 5308 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5309 | /* additional initialization for auto-configuration model */ |
| 5310 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5311 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5312 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5313 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5314 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5315 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5316 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5317 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5318 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5319 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5320 | } |
| 5321 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5322 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5323 | * one of two digital mic pins, e.g. on ALC272 |
| 5324 | */ |
| 5325 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5326 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5327 | struct alc_spec *spec = codec->spec; |
| 5328 | int i; |
| 5329 | |
| 5330 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5331 | hda_nid_t cap = spec->capsrc_nids ? |
| 5332 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5333 | int iidx, eidx; |
| 5334 | |
| 5335 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5336 | if (iidx < 0) |
| 5337 | continue; |
| 5338 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5339 | if (eidx < 0) |
| 5340 | continue; |
| 5341 | spec->int_mic.mux_idx = iidx; |
| 5342 | spec->ext_mic.mux_idx = eidx; |
| 5343 | if (spec->capsrc_nids) |
| 5344 | spec->capsrc_nids += i; |
| 5345 | spec->adc_nids += i; |
| 5346 | spec->num_adc_nids = 1; |
| 5347 | return; |
| 5348 | } |
| 5349 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5350 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5351 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5352 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5353 | } |
| 5354 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5355 | /* select or unmute the given capsrc route */ |
| 5356 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5357 | int idx) |
| 5358 | { |
| 5359 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5360 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5361 | HDA_AMP_MUTE, 0); |
| 5362 | } else { |
| 5363 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5364 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5365 | } |
| 5366 | } |
| 5367 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5368 | /* set the default connection to that pin */ |
| 5369 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5370 | { |
| 5371 | struct alc_spec *spec = codec->spec; |
| 5372 | int i; |
| 5373 | |
| 5374 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5375 | hda_nid_t cap = spec->capsrc_nids ? |
| 5376 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5377 | int idx; |
| 5378 | |
| 5379 | idx = get_connection_index(codec, cap, pin); |
| 5380 | if (idx < 0) |
| 5381 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5382 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5383 | return i; /* return the found index */ |
| 5384 | } |
| 5385 | return -1; /* not found */ |
| 5386 | } |
| 5387 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5388 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5389 | static void fixup_single_adc(struct hda_codec *codec) |
| 5390 | { |
| 5391 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5392 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5393 | int i; |
| 5394 | |
| 5395 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5396 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5397 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5398 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5399 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5400 | /* use only this ADC */ |
| 5401 | if (spec->capsrc_nids) |
| 5402 | spec->capsrc_nids += i; |
| 5403 | spec->adc_nids += i; |
| 5404 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5405 | } |
| 5406 | } |
| 5407 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5408 | /* initialize dual adcs */ |
| 5409 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5410 | { |
| 5411 | struct alc_spec *spec = codec->spec; |
| 5412 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5413 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5414 | } |
| 5415 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5416 | static void set_capture_mixer(struct hda_codec *codec) |
| 5417 | { |
| 5418 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5419 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5420 | { alc_capture_mixer_nosrc1, |
| 5421 | alc_capture_mixer_nosrc2, |
| 5422 | alc_capture_mixer_nosrc3 }, |
| 5423 | { alc_capture_mixer1, |
| 5424 | alc_capture_mixer2, |
| 5425 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5426 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5427 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5428 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5429 | int num_adcs = spec->num_adc_nids; |
| 5430 | if (spec->dual_adc_switch) |
| 5431 | fixup_dual_adc_switch(codec); |
| 5432 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5433 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5434 | else if (spec->input_mux) { |
| 5435 | if (spec->input_mux->num_items > 1) |
| 5436 | mux = 1; |
| 5437 | else if (spec->input_mux->num_items == 1) |
| 5438 | fixup_single_adc(codec); |
| 5439 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5440 | if (spec->dual_adc_switch) |
| 5441 | num_adcs = 1; |
| 5442 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5443 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5444 | } |
| 5445 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5446 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5447 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5448 | int num_nids) |
| 5449 | { |
| 5450 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5451 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5452 | int n; |
| 5453 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5454 | |
| 5455 | for (n = 0; n < num_nids; n++) { |
| 5456 | hda_nid_t adc, cap; |
| 5457 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5458 | int nconns, i, j; |
| 5459 | |
| 5460 | adc = nids[n]; |
| 5461 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5462 | continue; |
| 5463 | cap = adc; |
| 5464 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5465 | ARRAY_SIZE(conn)); |
| 5466 | if (nconns == 1) { |
| 5467 | cap = conn[0]; |
| 5468 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5469 | ARRAY_SIZE(conn)); |
| 5470 | } |
| 5471 | if (nconns <= 0) |
| 5472 | continue; |
| 5473 | if (!fallback_adc) { |
| 5474 | fallback_adc = adc; |
| 5475 | fallback_cap = cap; |
| 5476 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5477 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5478 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5479 | for (j = 0; j < nconns; j++) { |
| 5480 | if (conn[j] == nid) |
| 5481 | break; |
| 5482 | } |
| 5483 | if (j >= nconns) |
| 5484 | break; |
| 5485 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5486 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5487 | int num_adcs = spec->num_adc_nids; |
| 5488 | spec->private_adc_nids[num_adcs] = adc; |
| 5489 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5490 | spec->num_adc_nids++; |
| 5491 | spec->adc_nids = spec->private_adc_nids; |
| 5492 | if (adc != cap) |
| 5493 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5494 | } |
| 5495 | } |
| 5496 | if (!spec->num_adc_nids) { |
| 5497 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5498 | " using fallback 0x%x\n", |
| 5499 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5500 | spec->private_adc_nids[0] = fallback_adc; |
| 5501 | spec->adc_nids = spec->private_adc_nids; |
| 5502 | if (fallback_adc != fallback_cap) { |
| 5503 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5504 | spec->capsrc_nids = spec->private_adc_nids; |
| 5505 | } |
| 5506 | } |
| 5507 | } |
| 5508 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5509 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5510 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5511 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5512 | |
| 5513 | static struct snd_pci_quirk beep_white_list[] = { |
| 5514 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5515 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5516 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5517 | {} |
| 5518 | }; |
| 5519 | |
| 5520 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5521 | { |
| 5522 | struct alc_spec *spec = codec->spec; |
| 5523 | const struct snd_pci_quirk *q; |
| 5524 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5525 | if (q) |
| 5526 | return q->value; |
| 5527 | return spec->cdefine.enable_pcbeep; |
| 5528 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5529 | #else |
| 5530 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5531 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5532 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5533 | |
| 5534 | /* |
| 5535 | * OK, here we have finally the patch for ALC880 |
| 5536 | */ |
| 5537 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5538 | static int patch_alc880(struct hda_codec *codec) |
| 5539 | { |
| 5540 | struct alc_spec *spec; |
| 5541 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5542 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5543 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5544 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5545 | if (spec == NULL) |
| 5546 | return -ENOMEM; |
| 5547 | |
| 5548 | codec->spec = spec; |
| 5549 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5550 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5551 | alc880_models, |
| 5552 | alc880_cfg_tbl); |
| 5553 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5554 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5555 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5556 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5557 | } |
| 5558 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5559 | if (board_config == ALC880_AUTO) { |
| 5560 | /* automatic parse from the BIOS config */ |
| 5561 | err = alc880_parse_auto_config(codec); |
| 5562 | if (err < 0) { |
| 5563 | alc_free(codec); |
| 5564 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5565 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5566 | printk(KERN_INFO |
| 5567 | "hda_codec: Cannot set up configuration " |
| 5568 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5569 | board_config = ALC880_3ST; |
| 5570 | } |
| 5571 | } |
| 5572 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5573 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5574 | if (err < 0) { |
| 5575 | alc_free(codec); |
| 5576 | return err; |
| 5577 | } |
| 5578 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5579 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5580 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5581 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5582 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5583 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5584 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5585 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5586 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5587 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5588 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5589 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5590 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5591 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5592 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5593 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5594 | if (wcap != AC_WID_AUD_IN) { |
| 5595 | spec->adc_nids = alc880_adc_nids_alt; |
| 5596 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5597 | } else { |
| 5598 | spec->adc_nids = alc880_adc_nids; |
| 5599 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5600 | } |
| 5601 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5602 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5603 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5604 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5605 | spec->vmaster_nid = 0x0c; |
| 5606 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5607 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5608 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5609 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5610 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5611 | if (!spec->loopback.amplist) |
| 5612 | spec->loopback.amplist = alc880_loopbacks; |
| 5613 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5614 | |
| 5615 | return 0; |
| 5616 | } |
| 5617 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5618 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5619 | /* |
| 5620 | * ALC260 support |
| 5621 | */ |
| 5622 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5623 | static hda_nid_t alc260_dac_nids[1] = { |
| 5624 | /* front */ |
| 5625 | 0x02, |
| 5626 | }; |
| 5627 | |
| 5628 | static hda_nid_t alc260_adc_nids[1] = { |
| 5629 | /* ADC0 */ |
| 5630 | 0x04, |
| 5631 | }; |
| 5632 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5633 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5634 | /* ADC1 */ |
| 5635 | 0x05, |
| 5636 | }; |
| 5637 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5638 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5639 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5640 | */ |
| 5641 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5642 | /* ADC0, ADC1 */ |
| 5643 | 0x04, 0x05 |
| 5644 | }; |
| 5645 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5646 | #define ALC260_DIGOUT_NID 0x03 |
| 5647 | #define ALC260_DIGIN_NID 0x06 |
| 5648 | |
| 5649 | static struct hda_input_mux alc260_capture_source = { |
| 5650 | .num_items = 4, |
| 5651 | .items = { |
| 5652 | { "Mic", 0x0 }, |
| 5653 | { "Front Mic", 0x1 }, |
| 5654 | { "Line", 0x2 }, |
| 5655 | { "CD", 0x4 }, |
| 5656 | }, |
| 5657 | }; |
| 5658 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5659 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5660 | * headphone jack and the internal CD lines since these are the only pins at |
| 5661 | * which audio can appear. For flexibility, also allow the option of |
| 5662 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5663 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5664 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5665 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5666 | { |
| 5667 | .num_items = 3, |
| 5668 | .items = { |
| 5669 | { "Mic/Line", 0x0 }, |
| 5670 | { "CD", 0x4 }, |
| 5671 | { "Headphone", 0x2 }, |
| 5672 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5673 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5674 | { |
| 5675 | .num_items = 4, |
| 5676 | .items = { |
| 5677 | { "Mic/Line", 0x0 }, |
| 5678 | { "CD", 0x4 }, |
| 5679 | { "Headphone", 0x2 }, |
| 5680 | { "Mixer", 0x5 }, |
| 5681 | }, |
| 5682 | }, |
| 5683 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5684 | }; |
| 5685 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5686 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5687 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5688 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5689 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5690 | { |
| 5691 | .num_items = 4, |
| 5692 | .items = { |
| 5693 | { "Mic", 0x0 }, |
| 5694 | { "Line", 0x2 }, |
| 5695 | { "CD", 0x4 }, |
| 5696 | { "Headphone", 0x5 }, |
| 5697 | }, |
| 5698 | }, |
| 5699 | { |
| 5700 | .num_items = 5, |
| 5701 | .items = { |
| 5702 | { "Mic", 0x0 }, |
| 5703 | { "Line", 0x2 }, |
| 5704 | { "CD", 0x4 }, |
| 5705 | { "Headphone", 0x6 }, |
| 5706 | { "Mixer", 0x5 }, |
| 5707 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5708 | }, |
| 5709 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5710 | |
| 5711 | /* Maxdata Favorit 100XS */ |
| 5712 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5713 | { |
| 5714 | .num_items = 2, |
| 5715 | .items = { |
| 5716 | { "Line/Mic", 0x0 }, |
| 5717 | { "CD", 0x4 }, |
| 5718 | }, |
| 5719 | }, |
| 5720 | { |
| 5721 | .num_items = 3, |
| 5722 | .items = { |
| 5723 | { "Line/Mic", 0x0 }, |
| 5724 | { "CD", 0x4 }, |
| 5725 | { "Mixer", 0x5 }, |
| 5726 | }, |
| 5727 | }, |
| 5728 | }; |
| 5729 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5730 | /* |
| 5731 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5732 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5733 | * element which allows changing the channel mode, so the verb list is |
| 5734 | * never used. |
| 5735 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5736 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5737 | { 2, NULL }, |
| 5738 | }; |
| 5739 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5740 | |
| 5741 | /* Mixer combinations |
| 5742 | * |
| 5743 | * basic: base_output + input + pc_beep + capture |
| 5744 | * HP: base_output + input + capture_alt |
| 5745 | * HP_3013: hp_3013 + input + capture |
| 5746 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5747 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5748 | */ |
| 5749 | |
| 5750 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5751 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5752 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5753 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5754 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5755 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5756 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5757 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5758 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5759 | |
| 5760 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5761 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5762 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5763 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5764 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5765 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5766 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5767 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5768 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5769 | { } /* end */ |
| 5770 | }; |
| 5771 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5772 | /* update HP, line and mono out pins according to the master switch */ |
| 5773 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5774 | hda_nid_t hp, hda_nid_t line, |
| 5775 | hda_nid_t mono) |
| 5776 | { |
| 5777 | struct alc_spec *spec = codec->spec; |
| 5778 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5779 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5780 | 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] | 5781 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5782 | 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] | 5783 | val); |
| 5784 | /* mono (speaker) depending on the HP jack sense */ |
| 5785 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5786 | 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] | 5787 | val); |
| 5788 | } |
| 5789 | |
| 5790 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5791 | struct snd_ctl_elem_value *ucontrol) |
| 5792 | { |
| 5793 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5794 | struct alc_spec *spec = codec->spec; |
| 5795 | *ucontrol->value.integer.value = spec->master_sw; |
| 5796 | return 0; |
| 5797 | } |
| 5798 | |
| 5799 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5800 | struct snd_ctl_elem_value *ucontrol) |
| 5801 | { |
| 5802 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5803 | struct alc_spec *spec = codec->spec; |
| 5804 | int val = !!*ucontrol->value.integer.value; |
| 5805 | hda_nid_t hp, line, mono; |
| 5806 | |
| 5807 | if (val == spec->master_sw) |
| 5808 | return 0; |
| 5809 | spec->master_sw = val; |
| 5810 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5811 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5812 | mono = kcontrol->private_value & 0xff; |
| 5813 | alc260_hp_master_update(codec, hp, line, mono); |
| 5814 | return 1; |
| 5815 | } |
| 5816 | |
| 5817 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5818 | { |
| 5819 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5820 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5821 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5822 | .info = snd_ctl_boolean_mono_info, |
| 5823 | .get = alc260_hp_master_sw_get, |
| 5824 | .put = alc260_hp_master_sw_put, |
| 5825 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5826 | }, |
| 5827 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5828 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5829 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5830 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5831 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5832 | HDA_OUTPUT), |
| 5833 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5834 | { } /* end */ |
| 5835 | }; |
| 5836 | |
| 5837 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5838 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5839 | {}, |
| 5840 | }; |
| 5841 | |
| 5842 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5843 | { |
| 5844 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5845 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5846 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5847 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5848 | } |
| 5849 | |
| 5850 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5851 | { |
| 5852 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5853 | alc260_hp_automute(codec); |
| 5854 | } |
| 5855 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5856 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5857 | { |
| 5858 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5859 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5860 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5861 | .info = snd_ctl_boolean_mono_info, |
| 5862 | .get = alc260_hp_master_sw_get, |
| 5863 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5864 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5865 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5866 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5867 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5868 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5869 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5870 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5871 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5872 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5873 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5874 | { } /* end */ |
| 5875 | }; |
| 5876 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5877 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5878 | .ops = &snd_hda_bind_vol, |
| 5879 | .values = { |
| 5880 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5881 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5882 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5883 | 0 |
| 5884 | }, |
| 5885 | }; |
| 5886 | |
| 5887 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5888 | .ops = &snd_hda_bind_sw, |
| 5889 | .values = { |
| 5890 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5891 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5892 | 0 |
| 5893 | }, |
| 5894 | }; |
| 5895 | |
| 5896 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5897 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5898 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5899 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5900 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5901 | { } /* end */ |
| 5902 | }; |
| 5903 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5904 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5905 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5906 | {}, |
| 5907 | }; |
| 5908 | |
| 5909 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5910 | { |
| 5911 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5912 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5913 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5914 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5915 | } |
| 5916 | |
| 5917 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5918 | unsigned int res) |
| 5919 | { |
| 5920 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5921 | alc260_hp_3013_automute(codec); |
| 5922 | } |
| 5923 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5924 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5925 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5926 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5927 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5928 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5929 | bits); |
| 5930 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5931 | bits); |
| 5932 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5933 | bits); |
| 5934 | } |
| 5935 | |
| 5936 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5937 | unsigned int res) |
| 5938 | { |
| 5939 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5940 | alc260_hp_3012_automute(codec); |
| 5941 | } |
| 5942 | |
| 5943 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5944 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5945 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5946 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5947 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5948 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5949 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5950 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5951 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5952 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5953 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5954 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5955 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5956 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5957 | { } /* end */ |
| 5958 | }; |
| 5959 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5960 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5961 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5962 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5963 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5964 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5965 | * revisions available in early 2006. Therefore for now allow the |
| 5966 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5967 | * that the lack of mic bias for this NID is intentional we could change the |
| 5968 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5969 | * |
| 5970 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5971 | * don't appear to make the mic bias available from the "line" jack, even |
| 5972 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5973 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5974 | * and the output jack. If this turns out to be the case for all such |
| 5975 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5976 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5977 | * |
| 5978 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5979 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5980 | * controls for such models. On models without a "mono speaker" the control |
| 5981 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5982 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5983 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5984 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5985 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5986 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5987 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5988 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5989 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5990 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5991 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5992 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5995 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5996 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5997 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5998 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5999 | { } /* end */ |
| 6000 | }; |
| 6001 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6002 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6003 | */ |
| 6004 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6005 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6006 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6007 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6008 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6009 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6010 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6011 | { } /* end */ |
| 6012 | }; |
| 6013 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6014 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6015 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6016 | */ |
| 6017 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6018 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6019 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6022 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6023 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6024 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6025 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6026 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6027 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6028 | { } /* end */ |
| 6029 | }; |
| 6030 | |
| 6031 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6032 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6033 | */ |
| 6034 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6035 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6036 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6038 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6039 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6040 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6041 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6043 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6044 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6045 | { } /* end */ |
| 6046 | }; |
| 6047 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6048 | /* |
| 6049 | * initialization verbs |
| 6050 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6051 | static struct hda_verb alc260_init_verbs[] = { |
| 6052 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6053 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6054 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6055 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6056 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6057 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6058 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6059 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6060 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6061 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6062 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6063 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6064 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6065 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6066 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6067 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6068 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6069 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6070 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6071 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6072 | /* set connection select to line in (default select for this ADC) */ |
| 6073 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6074 | /* mute capture amp left and right */ |
| 6075 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6076 | /* set connection select to line in (default select for this ADC) */ |
| 6077 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6078 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6079 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6080 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6081 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6082 | /* set vol=0 HP mixer amp left and right */ |
| 6083 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6084 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6085 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6086 | /* set vol=0 Mono mixer amp left and right */ |
| 6087 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6088 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6089 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6090 | /* unmute LINE-2 out pin */ |
| 6091 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6092 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6093 | * Line In 2 = 0x03 |
| 6094 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6095 | /* mute analog inputs */ |
| 6096 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6097 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6098 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6099 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6100 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6101 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6102 | /* mute Front out path */ |
| 6103 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6104 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6105 | /* mute Headphone out path */ |
| 6106 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6107 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6108 | /* mute Mono out path */ |
| 6109 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6110 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6111 | { } |
| 6112 | }; |
| 6113 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6114 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6115 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6116 | /* Headphone and output */ |
| 6117 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6118 | /* mono output */ |
| 6119 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6120 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6121 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6122 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6123 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6124 | /* Line In pin widget for input */ |
| 6125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6126 | /* Line-2 pin widget for output */ |
| 6127 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6128 | /* CD pin widget for input */ |
| 6129 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6130 | /* unmute amp left and right */ |
| 6131 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6132 | /* set connection select to line in (default select for this ADC) */ |
| 6133 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6134 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6135 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6136 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6137 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6138 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6139 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6140 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6141 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6142 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6143 | * Line In 2 = 0x03 |
| 6144 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6145 | /* mute analog inputs */ |
| 6146 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6148 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6149 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6150 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6151 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6152 | /* Unmute Front out path */ |
| 6153 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6154 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6155 | /* Unmute Headphone out path */ |
| 6156 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6157 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6158 | /* Unmute Mono out path */ |
| 6159 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6160 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6161 | { } |
| 6162 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6163 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6164 | |
| 6165 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6166 | /* Line out and output */ |
| 6167 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6168 | /* mono output */ |
| 6169 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6170 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6171 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6172 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6173 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6174 | /* Line In pin widget for input */ |
| 6175 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6176 | /* Headphone pin widget for output */ |
| 6177 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6178 | /* CD pin widget for input */ |
| 6179 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6180 | /* unmute amp left and right */ |
| 6181 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6182 | /* set connection select to line in (default select for this ADC) */ |
| 6183 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6184 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6185 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6186 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6188 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6189 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6190 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6191 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6192 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6193 | * Line In 2 = 0x03 |
| 6194 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6195 | /* mute analog inputs */ |
| 6196 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6197 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6201 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6202 | /* Unmute Front out path */ |
| 6203 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6204 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6205 | /* Unmute Headphone out path */ |
| 6206 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6207 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6208 | /* Unmute Mono out path */ |
| 6209 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6210 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6211 | { } |
| 6212 | }; |
| 6213 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6214 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6215 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6216 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6217 | */ |
| 6218 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6219 | /* Disable all GPIOs */ |
| 6220 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6221 | /* Internal speaker is connected to headphone pin */ |
| 6222 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6223 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6224 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6225 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6226 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6227 | /* Ensure all other unused pins are disabled and muted. */ |
| 6228 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6229 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6230 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6231 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6232 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6233 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6234 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6235 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6236 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6237 | /* Disable digital (SPDIF) pins */ |
| 6238 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6239 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6240 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6241 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6242 | * when acting as an output. |
| 6243 | */ |
| 6244 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6245 | |
| 6246 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6247 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6248 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6250 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6251 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6252 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6253 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6254 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6255 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6256 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6257 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6258 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6259 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6260 | * If the pin mode is changed by the user the pin mode control will |
| 6261 | * take care of enabling the pin's input/output buffers as needed. |
| 6262 | * Therefore there's no need to enable the input buffer at this |
| 6263 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6264 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6265 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6266 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6267 | * mixer ctrl) |
| 6268 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6269 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6270 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6271 | /* Mute capture amp left and right */ |
| 6272 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6273 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6274 | * in (on mic1 pin) |
| 6275 | */ |
| 6276 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6277 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6278 | /* Do the same for the second ADC: mute capture input amp and |
| 6279 | * set ADC connection to line in (on mic1 pin) |
| 6280 | */ |
| 6281 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6282 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6283 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6284 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6285 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6287 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6288 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6289 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6290 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6291 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6292 | {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] | 6293 | |
| 6294 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6295 | }; |
| 6296 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6297 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6298 | * similar laptops (adapted from Fujitsu init verbs). |
| 6299 | */ |
| 6300 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6301 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6302 | * the headphone jack. Turn this on and rely on the standard mute |
| 6303 | * methods whenever the user wants to turn these outputs off. |
| 6304 | */ |
| 6305 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6306 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6307 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6308 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6309 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6310 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6311 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6312 | /* Line In jack is connected to Line1 pin */ |
| 6313 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6314 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6315 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6316 | /* Ensure all other unused pins are disabled and muted. */ |
| 6317 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6318 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6319 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6320 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6321 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6322 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6323 | /* Disable digital (SPDIF) pins */ |
| 6324 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6325 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6326 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6327 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6328 | * bus when acting as outputs. |
| 6329 | */ |
| 6330 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6331 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6332 | |
| 6333 | /* Start with output sum widgets muted and their output gains at min */ |
| 6334 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6335 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6336 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6337 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6338 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6339 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6340 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6341 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6342 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6343 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6344 | /* Unmute Line-out pin widget amp left and right |
| 6345 | * (no equiv mixer ctrl) |
| 6346 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6347 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6348 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6349 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6350 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6351 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6352 | * will take care of enabling the pin's input/output buffers as needed. |
| 6353 | * Therefore there's no need to enable the input buffer at this |
| 6354 | * stage. |
| 6355 | */ |
| 6356 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6357 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6358 | |
| 6359 | /* Mute capture amp left and right */ |
| 6360 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6361 | /* Set ADC connection select to match default mixer setting - mic |
| 6362 | * (on mic1 pin) |
| 6363 | */ |
| 6364 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6365 | |
| 6366 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6367 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6368 | */ |
| 6369 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6370 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6371 | |
| 6372 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6373 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6374 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6375 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6376 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6377 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6378 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6379 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6380 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6381 | |
| 6382 | { } |
| 6383 | }; |
| 6384 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6385 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6386 | * (adapted from Acer init verbs). |
| 6387 | */ |
| 6388 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6389 | /* GPIO 0 enables the output jack. |
| 6390 | * Turn this on and rely on the standard mute |
| 6391 | * methods whenever the user wants to turn these outputs off. |
| 6392 | */ |
| 6393 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6394 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6395 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6396 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6397 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6398 | /* Ensure all other unused pins are disabled and muted. */ |
| 6399 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6400 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6401 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6402 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6403 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6404 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6406 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6407 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6408 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6409 | /* Disable digital (SPDIF) pins */ |
| 6410 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6411 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6412 | |
| 6413 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6414 | * bus when acting as outputs. |
| 6415 | */ |
| 6416 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6417 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6418 | |
| 6419 | /* Start with output sum widgets muted and their output gains at min */ |
| 6420 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6421 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6422 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6423 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6424 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6426 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6427 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6428 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6429 | |
| 6430 | /* Unmute Line-out pin widget amp left and right |
| 6431 | * (no equiv mixer ctrl) |
| 6432 | */ |
| 6433 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6434 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6435 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6436 | * will take care of enabling the pin's input/output buffers as needed. |
| 6437 | * Therefore there's no need to enable the input buffer at this |
| 6438 | * stage. |
| 6439 | */ |
| 6440 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6441 | |
| 6442 | /* Mute capture amp left and right */ |
| 6443 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6444 | /* Set ADC connection select to match default mixer setting - mic |
| 6445 | * (on mic1 pin) |
| 6446 | */ |
| 6447 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6448 | |
| 6449 | /* Do similar with the second ADC: mute capture input amp and |
| 6450 | * set ADC connection to mic to match ALSA's default state. |
| 6451 | */ |
| 6452 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6453 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6454 | |
| 6455 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6462 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6463 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6464 | |
| 6465 | { } |
| 6466 | }; |
| 6467 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6468 | static struct hda_verb alc260_will_verbs[] = { |
| 6469 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6470 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6471 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6472 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6473 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6474 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6475 | {} |
| 6476 | }; |
| 6477 | |
| 6478 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6479 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6480 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6481 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6482 | |
| 6483 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6484 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6485 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6486 | |
| 6487 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6488 | {} |
| 6489 | }; |
| 6490 | |
| 6491 | /* toggle speaker-output according to the hp-jack state */ |
| 6492 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6493 | { |
| 6494 | unsigned int present; |
| 6495 | |
| 6496 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6497 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6498 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6499 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6500 | AC_VERB_SET_GPIO_DATA, 1); |
| 6501 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6502 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6503 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6504 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6505 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6506 | AC_VERB_SET_GPIO_DATA, 0); |
| 6507 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6508 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6509 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6510 | } |
| 6511 | } |
| 6512 | |
| 6513 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6514 | unsigned int res) |
| 6515 | { |
| 6516 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6517 | alc260_replacer_672v_automute(codec); |
| 6518 | } |
| 6519 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6520 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6521 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6522 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6523 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6524 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6525 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6526 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6527 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6528 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6529 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6530 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6531 | {} |
| 6532 | }; |
| 6533 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6534 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6535 | * configuration. |
| 6536 | */ |
| 6537 | #ifdef CONFIG_SND_DEBUG |
| 6538 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6539 | 0x02, |
| 6540 | }; |
| 6541 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6542 | 0x04, 0x05, |
| 6543 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6544 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6545 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6546 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6547 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6548 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6549 | { |
| 6550 | .num_items = 7, |
| 6551 | .items = { |
| 6552 | { "MIC1 pin", 0x0 }, |
| 6553 | { "MIC2 pin", 0x1 }, |
| 6554 | { "LINE1 pin", 0x2 }, |
| 6555 | { "LINE2 pin", 0x3 }, |
| 6556 | { "CD pin", 0x4 }, |
| 6557 | { "LINE-OUT pin", 0x5 }, |
| 6558 | { "HP-OUT pin", 0x6 }, |
| 6559 | }, |
| 6560 | }, |
| 6561 | { |
| 6562 | .num_items = 8, |
| 6563 | .items = { |
| 6564 | { "MIC1 pin", 0x0 }, |
| 6565 | { "MIC2 pin", 0x1 }, |
| 6566 | { "LINE1 pin", 0x2 }, |
| 6567 | { "LINE2 pin", 0x3 }, |
| 6568 | { "CD pin", 0x4 }, |
| 6569 | { "Mixer", 0x5 }, |
| 6570 | { "LINE-OUT pin", 0x6 }, |
| 6571 | { "HP-OUT pin", 0x7 }, |
| 6572 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6573 | }, |
| 6574 | }; |
| 6575 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6576 | /* Output driver widgets */ |
| 6577 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6578 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6579 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6580 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6581 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6582 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6583 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6584 | /* Modes for retasking pin widgets |
| 6585 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6586 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6587 | * mention this restriction. At this stage it's not clear whether |
| 6588 | * this behaviour is intentional or is a hardware bug in chip |
| 6589 | * revisions available at least up until early 2006. Therefore for |
| 6590 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6591 | * choices, but if it turns out that the lack of mic bias for these |
| 6592 | * NIDs is intentional we could change their modes from |
| 6593 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6594 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6595 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6596 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6597 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6598 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6599 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6600 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6601 | |
| 6602 | /* Loopback mixer controls */ |
| 6603 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6604 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6605 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6606 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6607 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6608 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6609 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6610 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6611 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6612 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6613 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6614 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6615 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6616 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6617 | |
| 6618 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6619 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6620 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6621 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6622 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6623 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6624 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6625 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6626 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6627 | */ |
| 6628 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6629 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6630 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6631 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6632 | * this output to turn on an external amplifier. |
| 6633 | */ |
| 6634 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6635 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6636 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6637 | { } /* end */ |
| 6638 | }; |
| 6639 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6640 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6641 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6642 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6643 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6644 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6645 | /* Enable retasking pins as output, initially without power amp */ |
| 6646 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6647 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6648 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6650 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6651 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6652 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6653 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6654 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6655 | * payload also sets the generation to 0, output to be in "consumer" |
| 6656 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6657 | * control. |
| 6658 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6659 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6660 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6661 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6662 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6663 | * OUT1 sum bus when acting as an output. |
| 6664 | */ |
| 6665 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6666 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6667 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6668 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6669 | |
| 6670 | /* Start with output sum widgets muted and their output gains at min */ |
| 6671 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6672 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6673 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6674 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6675 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6676 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6677 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6678 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6679 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6680 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6681 | /* Unmute retasking pin widget output buffers since the default |
| 6682 | * state appears to be output. As the pin mode is changed by the |
| 6683 | * user the pin mode control will take care of enabling the pin's |
| 6684 | * input/output buffers as needed. |
| 6685 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6686 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6687 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6688 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6689 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6690 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6691 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6692 | /* Also unmute the mono-out pin widget */ |
| 6693 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6694 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6695 | /* Mute capture amp left and right */ |
| 6696 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6697 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6698 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6699 | */ |
| 6700 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6701 | |
| 6702 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6703 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6704 | */ |
| 6705 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6706 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6707 | |
| 6708 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6709 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6711 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6713 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6714 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6715 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6716 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6717 | |
| 6718 | { } |
| 6719 | }; |
| 6720 | #endif |
| 6721 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6722 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6723 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6724 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6725 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6726 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6727 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6728 | /* |
| 6729 | * for BIOS auto-configuration |
| 6730 | */ |
| 6731 | |
| 6732 | 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] | 6733 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6734 | { |
| 6735 | hda_nid_t nid_vol; |
| 6736 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6737 | int err; |
| 6738 | |
| 6739 | if (nid >= 0x0f && nid < 0x11) { |
| 6740 | nid_vol = nid - 0x7; |
| 6741 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6742 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6743 | } else if (nid == 0x11) { |
| 6744 | nid_vol = nid - 0x7; |
| 6745 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6746 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6747 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6748 | nid_vol = 0x08; |
| 6749 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6750 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6751 | } else |
| 6752 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6753 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6754 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6755 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6756 | 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] | 6757 | if (err < 0) |
| 6758 | return err; |
| 6759 | *vol_bits |= (1 << nid_vol); |
| 6760 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6761 | 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] | 6762 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6763 | return err; |
| 6764 | return 1; |
| 6765 | } |
| 6766 | |
| 6767 | /* add playback controls from the parsed DAC table */ |
| 6768 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6769 | const struct auto_pin_cfg *cfg) |
| 6770 | { |
| 6771 | hda_nid_t nid; |
| 6772 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6773 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6774 | |
| 6775 | spec->multiout.num_dacs = 1; |
| 6776 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6777 | spec->multiout.dac_nids[0] = 0x02; |
| 6778 | |
| 6779 | nid = cfg->line_out_pins[0]; |
| 6780 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6781 | const char *pfx; |
| 6782 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6783 | pfx = "Master"; |
| 6784 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6785 | pfx = "Speaker"; |
| 6786 | else |
| 6787 | pfx = "Front"; |
| 6788 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6789 | if (err < 0) |
| 6790 | return err; |
| 6791 | } |
| 6792 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6793 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6794 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6795 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6796 | if (err < 0) |
| 6797 | return err; |
| 6798 | } |
| 6799 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6800 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6801 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6802 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6803 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6804 | if (err < 0) |
| 6805 | return err; |
| 6806 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6807 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6808 | } |
| 6809 | |
| 6810 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6811 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6812 | const struct auto_pin_cfg *cfg) |
| 6813 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6814 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6815 | } |
| 6816 | |
| 6817 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6818 | hda_nid_t nid, int pin_type, |
| 6819 | int sel_idx) |
| 6820 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6821 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6822 | /* need the manual connection? */ |
| 6823 | if (nid >= 0x12) { |
| 6824 | int idx = nid - 0x12; |
| 6825 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6826 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6827 | } |
| 6828 | } |
| 6829 | |
| 6830 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6831 | { |
| 6832 | struct alc_spec *spec = codec->spec; |
| 6833 | hda_nid_t nid; |
| 6834 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6835 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6836 | if (nid) { |
| 6837 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6838 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6839 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6840 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6841 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6842 | if (nid) |
| 6843 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6844 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6845 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6846 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6847 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6848 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6849 | |
| 6850 | #define ALC260_PIN_CD_NID 0x16 |
| 6851 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6852 | { |
| 6853 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6854 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6855 | int i; |
| 6856 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6857 | for (i = 0; i < cfg->num_inputs; i++) { |
| 6858 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6859 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 6860 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6861 | if (nid != ALC260_PIN_CD_NID && |
| 6862 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6863 | snd_hda_codec_write(codec, nid, 0, |
| 6864 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6865 | AMP_OUT_MUTE); |
| 6866 | } |
| 6867 | } |
| 6868 | } |
| 6869 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6870 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6871 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6872 | /* |
| 6873 | * generic initialization of ADC, input mixers and output mixers |
| 6874 | */ |
| 6875 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6876 | /* |
| 6877 | * Unmute ADC0-1 and set the default input to mic-in |
| 6878 | */ |
| 6879 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6880 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6881 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6882 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6883 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6884 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6885 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6886 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6887 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6888 | */ |
| 6889 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6890 | /* mute analog inputs */ |
| 6891 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6892 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6893 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6894 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6895 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6896 | |
| 6897 | /* |
| 6898 | * Set up output mixers (0x08 - 0x0a) |
| 6899 | */ |
| 6900 | /* set vol=0 to output mixers */ |
| 6901 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6902 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6903 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6904 | /* set up input amps for analog loopback */ |
| 6905 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6906 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6907 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6908 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6909 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6910 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6911 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6913 | { } |
| 6914 | }; |
| 6915 | |
| 6916 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6917 | { |
| 6918 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6919 | int err; |
| 6920 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6921 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6922 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6923 | alc260_ignore); |
| 6924 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6925 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6926 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6927 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6928 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6929 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6930 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6931 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6932 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6933 | return err; |
| 6934 | |
| 6935 | spec->multiout.max_channels = 2; |
| 6936 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6937 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6938 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6939 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6940 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6941 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6942 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6943 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6944 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6945 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6946 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6947 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6948 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6949 | return 1; |
| 6950 | } |
| 6951 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6952 | /* additional initialization for auto-configuration model */ |
| 6953 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6954 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6955 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6956 | alc260_auto_init_multi_out(codec); |
| 6957 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6958 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 6959 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6960 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6961 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6962 | } |
| 6963 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6964 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6965 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6966 | { 0x07, HDA_INPUT, 0 }, |
| 6967 | { 0x07, HDA_INPUT, 1 }, |
| 6968 | { 0x07, HDA_INPUT, 2 }, |
| 6969 | { 0x07, HDA_INPUT, 3 }, |
| 6970 | { 0x07, HDA_INPUT, 4 }, |
| 6971 | { } /* end */ |
| 6972 | }; |
| 6973 | #endif |
| 6974 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6975 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6976 | * Pin config fixes |
| 6977 | */ |
| 6978 | enum { |
| 6979 | PINFIX_HP_DC5750, |
| 6980 | }; |
| 6981 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6982 | static const struct alc_fixup alc260_fixups[] = { |
| 6983 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 6984 | .pins = (const struct alc_pincfg[]) { |
| 6985 | { 0x11, 0x90130110 }, /* speaker */ |
| 6986 | { } |
| 6987 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6988 | }, |
| 6989 | }; |
| 6990 | |
| 6991 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 6992 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 6993 | {} |
| 6994 | }; |
| 6995 | |
| 6996 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6997 | * ALC260 configurations |
| 6998 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6999 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 7000 | [ALC260_BASIC] = "basic", |
| 7001 | [ALC260_HP] = "hp", |
| 7002 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7003 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7004 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7005 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7006 | [ALC260_WILL] = "will", |
| 7007 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7008 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7009 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7010 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7011 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7012 | [ALC260_AUTO] = "auto", |
| 7013 | }; |
| 7014 | |
| 7015 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7016 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7017 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7018 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7019 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7020 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7021 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7022 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7023 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7024 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7025 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7026 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7027 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7028 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7029 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7030 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7031 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7032 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7033 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7034 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7035 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7036 | {} |
| 7037 | }; |
| 7038 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7039 | static struct alc_config_preset alc260_presets[] = { |
| 7040 | [ALC260_BASIC] = { |
| 7041 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7042 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7043 | .init_verbs = { alc260_init_verbs }, |
| 7044 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7045 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7046 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7047 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7048 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7049 | .channel_mode = alc260_modes, |
| 7050 | .input_mux = &alc260_capture_source, |
| 7051 | }, |
| 7052 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7053 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7054 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7055 | .init_verbs = { alc260_init_verbs, |
| 7056 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7057 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7058 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7059 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7060 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7061 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7062 | .channel_mode = alc260_modes, |
| 7063 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7064 | .unsol_event = alc260_hp_unsol_event, |
| 7065 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7066 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7067 | [ALC260_HP_DC7600] = { |
| 7068 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7069 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7070 | .init_verbs = { alc260_init_verbs, |
| 7071 | alc260_hp_dc7600_verbs }, |
| 7072 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7073 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7074 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7075 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7076 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7077 | .channel_mode = alc260_modes, |
| 7078 | .input_mux = &alc260_capture_source, |
| 7079 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7080 | .init_hook = alc260_hp_3012_automute, |
| 7081 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7082 | [ALC260_HP_3013] = { |
| 7083 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7084 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7085 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7086 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7087 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7088 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7089 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7090 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7091 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7092 | .channel_mode = alc260_modes, |
| 7093 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7094 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7095 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7096 | }, |
| 7097 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7098 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7099 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7100 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7101 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7102 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7103 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7104 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7105 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7106 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7107 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7108 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7109 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7110 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7111 | .init_verbs = { alc260_acer_init_verbs }, |
| 7112 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7113 | .dac_nids = alc260_dac_nids, |
| 7114 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7115 | .adc_nids = alc260_dual_adc_nids, |
| 7116 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7117 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7118 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7119 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7120 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7121 | [ALC260_FAVORIT100] = { |
| 7122 | .mixers = { alc260_favorit100_mixer }, |
| 7123 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7124 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7125 | .dac_nids = alc260_dac_nids, |
| 7126 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7127 | .adc_nids = alc260_dual_adc_nids, |
| 7128 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7129 | .channel_mode = alc260_modes, |
| 7130 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7131 | .input_mux = alc260_favorit100_capture_sources, |
| 7132 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7133 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7134 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7135 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7136 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7137 | .dac_nids = alc260_dac_nids, |
| 7138 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7139 | .adc_nids = alc260_adc_nids, |
| 7140 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7141 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7142 | .channel_mode = alc260_modes, |
| 7143 | .input_mux = &alc260_capture_source, |
| 7144 | }, |
| 7145 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7146 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7147 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7148 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7149 | .dac_nids = alc260_dac_nids, |
| 7150 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7151 | .adc_nids = alc260_adc_nids, |
| 7152 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7153 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7154 | .channel_mode = alc260_modes, |
| 7155 | .input_mux = &alc260_capture_source, |
| 7156 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7157 | .init_hook = alc260_replacer_672v_automute, |
| 7158 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7159 | #ifdef CONFIG_SND_DEBUG |
| 7160 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7161 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7162 | .init_verbs = { alc260_test_init_verbs }, |
| 7163 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7164 | .dac_nids = alc260_test_dac_nids, |
| 7165 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7166 | .adc_nids = alc260_test_adc_nids, |
| 7167 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7168 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7169 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7170 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7171 | }, |
| 7172 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7173 | }; |
| 7174 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7175 | static int patch_alc260(struct hda_codec *codec) |
| 7176 | { |
| 7177 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7178 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7179 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7180 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7181 | if (spec == NULL) |
| 7182 | return -ENOMEM; |
| 7183 | |
| 7184 | codec->spec = spec; |
| 7185 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7186 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7187 | alc260_models, |
| 7188 | alc260_cfg_tbl); |
| 7189 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7190 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7191 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7192 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7193 | } |
| 7194 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7195 | if (board_config == ALC260_AUTO) |
| 7196 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); |
| 7197 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7198 | if (board_config == ALC260_AUTO) { |
| 7199 | /* automatic parse from the BIOS config */ |
| 7200 | err = alc260_parse_auto_config(codec); |
| 7201 | if (err < 0) { |
| 7202 | alc_free(codec); |
| 7203 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7204 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7205 | printk(KERN_INFO |
| 7206 | "hda_codec: Cannot set up configuration " |
| 7207 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7208 | board_config = ALC260_BASIC; |
| 7209 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7210 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7211 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7212 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7213 | if (err < 0) { |
| 7214 | alc_free(codec); |
| 7215 | return err; |
| 7216 | } |
| 7217 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7218 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7219 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7220 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7221 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7222 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7223 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7224 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7225 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7226 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7227 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7228 | if (!spec->adc_nids && spec->input_mux) { |
| 7229 | /* check whether NID 0x04 is valid */ |
| 7230 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7231 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7232 | /* get type */ |
| 7233 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7234 | spec->adc_nids = alc260_adc_nids_alt; |
| 7235 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7236 | } else { |
| 7237 | spec->adc_nids = alc260_adc_nids; |
| 7238 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7239 | } |
| 7240 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7241 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7242 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7243 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7244 | if (board_config == ALC260_AUTO) |
| 7245 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); |
| 7246 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7247 | spec->vmaster_nid = 0x08; |
| 7248 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7249 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7250 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7251 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7252 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7253 | if (!spec->loopback.amplist) |
| 7254 | spec->loopback.amplist = alc260_loopbacks; |
| 7255 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7256 | |
| 7257 | return 0; |
| 7258 | } |
| 7259 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7261 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7262 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7263 | * |
| 7264 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7265 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7266 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7267 | * 6-channel independent captures. |
| 7268 | * |
| 7269 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7270 | * driver yet). |
| 7271 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7272 | #define ALC882_DIGOUT_NID 0x06 |
| 7273 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7274 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7275 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7276 | #define ALC1200_DIGOUT_NID 0x10 |
| 7277 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7278 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7279 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7280 | { 8, NULL } |
| 7281 | }; |
| 7282 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7283 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7284 | static hda_nid_t alc882_dac_nids[4] = { |
| 7285 | /* front, rear, clfe, rear_surr */ |
| 7286 | 0x02, 0x03, 0x04, 0x05 |
| 7287 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7288 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7289 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7290 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7291 | #define alc882_adc_nids alc880_adc_nids |
| 7292 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7293 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7294 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7295 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7296 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7297 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7298 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7299 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7300 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7301 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7302 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7303 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7304 | /* input MUX */ |
| 7305 | /* FIXME: should be a matrix-type input source selection */ |
| 7306 | |
| 7307 | static struct hda_input_mux alc882_capture_source = { |
| 7308 | .num_items = 4, |
| 7309 | .items = { |
| 7310 | { "Mic", 0x0 }, |
| 7311 | { "Front Mic", 0x1 }, |
| 7312 | { "Line", 0x2 }, |
| 7313 | { "CD", 0x4 }, |
| 7314 | }, |
| 7315 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7316 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7317 | #define alc883_capture_source alc882_capture_source |
| 7318 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7319 | static struct hda_input_mux alc889_capture_source = { |
| 7320 | .num_items = 3, |
| 7321 | .items = { |
| 7322 | { "Front Mic", 0x0 }, |
| 7323 | { "Mic", 0x3 }, |
| 7324 | { "Line", 0x2 }, |
| 7325 | }, |
| 7326 | }; |
| 7327 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7328 | static struct hda_input_mux mb5_capture_source = { |
| 7329 | .num_items = 3, |
| 7330 | .items = { |
| 7331 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7332 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7333 | { "CD", 0x4 }, |
| 7334 | }, |
| 7335 | }; |
| 7336 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7337 | static struct hda_input_mux macmini3_capture_source = { |
| 7338 | .num_items = 2, |
| 7339 | .items = { |
| 7340 | { "Line", 0x2 }, |
| 7341 | { "CD", 0x4 }, |
| 7342 | }, |
| 7343 | }; |
| 7344 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7345 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7346 | .num_items = 4, |
| 7347 | .items = { |
| 7348 | { "Mic", 0x1 }, |
| 7349 | { "Front Mic", 0x0 }, |
| 7350 | { "Line", 0x2 }, |
| 7351 | { "CD", 0x4 }, |
| 7352 | }, |
| 7353 | }; |
| 7354 | |
| 7355 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7356 | .num_items = 2, |
| 7357 | .items = { |
| 7358 | { "Mic", 0x1 }, |
| 7359 | { "Line", 0x2 }, |
| 7360 | }, |
| 7361 | }; |
| 7362 | |
| 7363 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7364 | .num_items = 4, |
| 7365 | .items = { |
| 7366 | { "Mic", 0x0 }, |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 7367 | { "Int Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7368 | { "Line", 0x2 }, |
| 7369 | { "CD", 0x4 }, |
| 7370 | }, |
| 7371 | }; |
| 7372 | |
| 7373 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7374 | .num_items = 2, |
| 7375 | .items = { |
| 7376 | { "Mic", 0x0 }, |
| 7377 | { "Int Mic", 0x1 }, |
| 7378 | }, |
| 7379 | }; |
| 7380 | |
| 7381 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7382 | .num_items = 3, |
| 7383 | .items = { |
| 7384 | { "Mic", 0x0 }, |
| 7385 | { "Front Mic", 0x1 }, |
| 7386 | { "Line", 0x4 }, |
| 7387 | }, |
| 7388 | }; |
| 7389 | |
| 7390 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7391 | .num_items = 2, |
| 7392 | .items = { |
| 7393 | { "Mic", 0x0 }, |
| 7394 | { "Line", 0x2 }, |
| 7395 | }, |
| 7396 | }; |
| 7397 | |
| 7398 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7399 | .num_items = 2, |
| 7400 | .items = { |
| 7401 | { "Mic", 0x0 }, |
| 7402 | /* Front Mic (0x01) unused */ |
| 7403 | { "Line", 0x2 }, |
| 7404 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7405 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7406 | }, |
| 7407 | }; |
| 7408 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7409 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7410 | .num_items = 2, |
| 7411 | .items = { |
| 7412 | { "Mic", 0x01 }, |
| 7413 | { "Line", 0x2 }, /* Not sure! */ |
| 7414 | }, |
| 7415 | }; |
| 7416 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7417 | /* |
| 7418 | * 2ch mode |
| 7419 | */ |
| 7420 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7421 | { 2, NULL } |
| 7422 | }; |
| 7423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7424 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7425 | * 2ch mode |
| 7426 | */ |
| 7427 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7428 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7429 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7430 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7431 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7432 | { } /* end */ |
| 7433 | }; |
| 7434 | |
| 7435 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7436 | * 4ch mode |
| 7437 | */ |
| 7438 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7439 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7440 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7441 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7442 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7443 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7444 | { } /* end */ |
| 7445 | }; |
| 7446 | |
| 7447 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7448 | * 6ch mode |
| 7449 | */ |
| 7450 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7451 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7452 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7453 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7454 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7455 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7456 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7457 | { } /* end */ |
| 7458 | }; |
| 7459 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7460 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7461 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7462 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7463 | { 6, alc882_3ST_ch6_init }, |
| 7464 | }; |
| 7465 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7466 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7467 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7468 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7469 | * 2ch mode |
| 7470 | */ |
| 7471 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7472 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7473 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7474 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7475 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7476 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7477 | { } /* end */ |
| 7478 | }; |
| 7479 | |
| 7480 | /* |
| 7481 | * 4ch mode |
| 7482 | */ |
| 7483 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7484 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7485 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7486 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7487 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7488 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7489 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7490 | { } /* end */ |
| 7491 | }; |
| 7492 | |
| 7493 | /* |
| 7494 | * 6ch mode |
| 7495 | */ |
| 7496 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7497 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7498 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7499 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7500 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7501 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7502 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7503 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7504 | { } /* end */ |
| 7505 | }; |
| 7506 | |
| 7507 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7508 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7509 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7510 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7511 | }; |
| 7512 | |
| 7513 | |
| 7514 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7515 | * 6ch mode |
| 7516 | */ |
| 7517 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7518 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7519 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7520 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7521 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7522 | { } /* end */ |
| 7523 | }; |
| 7524 | |
| 7525 | /* |
| 7526 | * 8ch mode |
| 7527 | */ |
| 7528 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7529 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7530 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7531 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7532 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7533 | { } /* end */ |
| 7534 | }; |
| 7535 | |
| 7536 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7537 | { 6, alc882_sixstack_ch6_init }, |
| 7538 | { 8, alc882_sixstack_ch8_init }, |
| 7539 | }; |
| 7540 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7541 | |
| 7542 | /* Macbook Air 2,1 */ |
| 7543 | |
| 7544 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7545 | { 2, NULL }, |
| 7546 | }; |
| 7547 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7548 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7549 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7550 | */ |
| 7551 | |
| 7552 | /* |
| 7553 | * 2ch mode |
| 7554 | */ |
| 7555 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7556 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7557 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7558 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7559 | { } /* end */ |
| 7560 | }; |
| 7561 | |
| 7562 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7563 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7564 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7565 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7566 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7567 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7568 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7569 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7570 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7571 | { } /* end */ |
| 7572 | }; |
| 7573 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7574 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7575 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7576 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7577 | }; |
| 7578 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7579 | /* |
| 7580 | * 2ch |
| 7581 | * Speakers/Woofer/HP = Front |
| 7582 | * LineIn = Input |
| 7583 | */ |
| 7584 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7586 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7587 | { } /* end */ |
| 7588 | }; |
| 7589 | |
| 7590 | /* |
| 7591 | * 6ch mode |
| 7592 | * Speakers/HP = Front |
| 7593 | * Woofer = LFE |
| 7594 | * LineIn = Surround |
| 7595 | */ |
| 7596 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7597 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7598 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7599 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7600 | { } /* end */ |
| 7601 | }; |
| 7602 | |
| 7603 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7604 | { 2, alc885_mb5_ch2_init }, |
| 7605 | { 6, alc885_mb5_ch6_init }, |
| 7606 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7607 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7608 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7609 | |
| 7610 | /* |
| 7611 | * 2ch mode |
| 7612 | */ |
| 7613 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7614 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7615 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7616 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7617 | { 0x18, 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_4ST_ch4_init[] = { |
| 7627 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7628 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7629 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7630 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7631 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7632 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7633 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7634 | { } /* end */ |
| 7635 | }; |
| 7636 | |
| 7637 | /* |
| 7638 | * 6ch mode |
| 7639 | */ |
| 7640 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7641 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7642 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7643 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7644 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7645 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7646 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7647 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7648 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7649 | { } /* end */ |
| 7650 | }; |
| 7651 | |
| 7652 | /* |
| 7653 | * 8ch mode |
| 7654 | */ |
| 7655 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7656 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7657 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7658 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7659 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7660 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7661 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7662 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7663 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7664 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7665 | { } /* end */ |
| 7666 | }; |
| 7667 | |
| 7668 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7669 | { 2, alc883_4ST_ch2_init }, |
| 7670 | { 4, alc883_4ST_ch4_init }, |
| 7671 | { 6, alc883_4ST_ch6_init }, |
| 7672 | { 8, alc883_4ST_ch8_init }, |
| 7673 | }; |
| 7674 | |
| 7675 | |
| 7676 | /* |
| 7677 | * 2ch mode |
| 7678 | */ |
| 7679 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7680 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7681 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7682 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7683 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7684 | { } /* end */ |
| 7685 | }; |
| 7686 | |
| 7687 | /* |
| 7688 | * 4ch mode |
| 7689 | */ |
| 7690 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7691 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7692 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7693 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7694 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7695 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7696 | { } /* end */ |
| 7697 | }; |
| 7698 | |
| 7699 | /* |
| 7700 | * 6ch mode |
| 7701 | */ |
| 7702 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7703 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7704 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7705 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7706 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7707 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7708 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7709 | { } /* end */ |
| 7710 | }; |
| 7711 | |
| 7712 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7713 | { 2, alc883_3ST_ch2_intel_init }, |
| 7714 | { 4, alc883_3ST_ch4_intel_init }, |
| 7715 | { 6, alc883_3ST_ch6_intel_init }, |
| 7716 | }; |
| 7717 | |
| 7718 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7719 | * 2ch mode |
| 7720 | */ |
| 7721 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7722 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7723 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7724 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7725 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7726 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7727 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7728 | { } /* end */ |
| 7729 | }; |
| 7730 | |
| 7731 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7732 | * 6ch mode |
| 7733 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7734 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7735 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7736 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7737 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7738 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7739 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7740 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7741 | { } /* end */ |
| 7742 | }; |
| 7743 | |
| 7744 | /* |
| 7745 | * 8ch mode |
| 7746 | */ |
| 7747 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7748 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7749 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7750 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7751 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7752 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7753 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7754 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7755 | { } /* end */ |
| 7756 | }; |
| 7757 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7758 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7759 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7760 | { 6, alc889_ch6_intel_init }, |
| 7761 | { 8, alc889_ch8_intel_init }, |
| 7762 | }; |
| 7763 | |
| 7764 | /* |
| 7765 | * 6ch mode |
| 7766 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7767 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7768 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7769 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7770 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7771 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7772 | { } /* end */ |
| 7773 | }; |
| 7774 | |
| 7775 | /* |
| 7776 | * 8ch mode |
| 7777 | */ |
| 7778 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7779 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7780 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7781 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7782 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7783 | { } /* end */ |
| 7784 | }; |
| 7785 | |
| 7786 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7787 | { 6, alc883_sixstack_ch6_init }, |
| 7788 | { 8, alc883_sixstack_ch8_init }, |
| 7789 | }; |
| 7790 | |
| 7791 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7792 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7793 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7794 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7795 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7796 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7797 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7798 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7799 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7800 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7801 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7802 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7803 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7804 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7805 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7806 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7807 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7808 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7809 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7810 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7812 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7814 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7815 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7816 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7817 | { } /* end */ |
| 7818 | }; |
| 7819 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7820 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7821 | |
| 7822 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7823 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7824 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7825 | { } |
| 7826 | }; |
| 7827 | |
| 7828 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7829 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7830 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7831 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7832 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7833 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7834 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7835 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7836 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7838 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7839 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7840 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7841 | { } /* end */ |
| 7842 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7843 | |
| 7844 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7845 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7846 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7847 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7848 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7849 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7850 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7851 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7852 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7853 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7854 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7856 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7857 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7858 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7859 | { } /* end */ |
| 7860 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7861 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7862 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7864 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7865 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7866 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7867 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7868 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7869 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7870 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7872 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7873 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7874 | { } /* end */ |
| 7875 | }; |
| 7876 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7877 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7878 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7879 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7880 | { } /* end */ |
| 7881 | }; |
| 7882 | |
| 7883 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7884 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7885 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7886 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7887 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7888 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7889 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7890 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7891 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7892 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7893 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7894 | { } /* end */ |
| 7895 | }; |
| 7896 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7897 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7898 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7899 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7900 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7901 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7902 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7903 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7904 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7905 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7907 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7908 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7909 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7910 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7911 | { } /* end */ |
| 7912 | }; |
| 7913 | |
| 7914 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7915 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7916 | */ |
| 7917 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7918 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7919 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7920 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7921 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7922 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7923 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7924 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7925 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7926 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7927 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7928 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7929 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7930 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7931 | { } /* end */ |
| 7932 | }; |
| 7933 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7934 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7935 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7936 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7937 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7938 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7939 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7940 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7941 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7943 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7944 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7945 | { } /* end */ |
| 7946 | }; |
| 7947 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7948 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7949 | { |
| 7950 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7951 | .name = "Channel Mode", |
| 7952 | .info = alc_ch_mode_info, |
| 7953 | .get = alc_ch_mode_get, |
| 7954 | .put = alc_ch_mode_put, |
| 7955 | }, |
| 7956 | { } /* end */ |
| 7957 | }; |
| 7958 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7959 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7960 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7961 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7962 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7963 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7964 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7966 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7968 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7969 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7970 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7971 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7972 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7973 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7974 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7975 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7976 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7977 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7979 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7980 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7981 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7982 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7983 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7984 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7985 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7986 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7987 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7988 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7989 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7990 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7991 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7992 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7993 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7994 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7995 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7996 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7997 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7998 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7999 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8000 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8001 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8002 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8003 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8004 | |
| 8005 | /* FIXME: use matrix-type input source selection */ |
| 8006 | /* 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] | 8007 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8008 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8009 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8010 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8011 | /* ADC2: mute amp left and right */ |
| 8012 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8013 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8014 | /* ADC3: mute amp left and right */ |
| 8015 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8016 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8017 | |
| 8018 | { } |
| 8019 | }; |
| 8020 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8021 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8022 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8023 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8024 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8025 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8027 | /* ADC1: mute amp left and right */ |
| 8028 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8029 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8030 | { } |
| 8031 | }; |
| 8032 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8033 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8034 | /* change to EAPD mode */ |
| 8035 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8036 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8037 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8038 | }; |
| 8039 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8040 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8041 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8042 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8043 | { } |
| 8044 | }; |
| 8045 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8046 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8047 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8048 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8049 | {} |
| 8050 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8051 | |
| 8052 | static struct hda_verb alc885_init_verbs[] = { |
| 8053 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8056 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8058 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8059 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8060 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8061 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8062 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8063 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8064 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8065 | |
| 8066 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8067 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8068 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8069 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8070 | /* Front Pin: output 0 (0x0c) */ |
| 8071 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8072 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8073 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8074 | /* Rear Pin: output 1 (0x0d) */ |
| 8075 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8077 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8078 | /* CLFE Pin: output 2 (0x0e) */ |
| 8079 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8080 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8081 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8082 | /* Side Pin: output 3 (0x0f) */ |
| 8083 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8084 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8085 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8086 | /* Mic (rear) pin: input vref at 80% */ |
| 8087 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8088 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8089 | /* Front Mic pin: input vref at 80% */ |
| 8090 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8091 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8092 | /* Line In pin: input */ |
| 8093 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8094 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8095 | |
| 8096 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8097 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8098 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8099 | /* Input mixer2 */ |
| 8100 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8101 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8103 | /* ADC2: mute amp left and right */ |
| 8104 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8105 | /* ADC3: mute amp left and right */ |
| 8106 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8107 | |
| 8108 | { } |
| 8109 | }; |
| 8110 | |
| 8111 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8112 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8113 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8114 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8115 | { } |
| 8116 | }; |
| 8117 | |
| 8118 | |
| 8119 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8120 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8121 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8122 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8123 | { } |
| 8124 | }; |
| 8125 | |
| 8126 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8127 | #define alc883_init_verbs alc882_base_init_verbs |
| 8128 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8129 | /* Mac Pro test */ |
| 8130 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8131 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8132 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8133 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8134 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8135 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8136 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8137 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8138 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8139 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8140 | { } /* end */ |
| 8141 | }; |
| 8142 | |
| 8143 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8144 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8145 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8146 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8147 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8148 | /* Front Pin: output 0 (0x0c) */ |
| 8149 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8150 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8151 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8152 | /* Front Mic pin: input vref at 80% */ |
| 8153 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8154 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8155 | /* Speaker: output */ |
| 8156 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8157 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8158 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8159 | /* Headphone output (output 0 - 0x0c) */ |
| 8160 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8161 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8162 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8163 | |
| 8164 | /* FIXME: use matrix-type input source selection */ |
| 8165 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8166 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8167 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8168 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8169 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8170 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8171 | /* Input mixer2 */ |
| 8172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8174 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8175 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8176 | /* Input mixer3 */ |
| 8177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8181 | /* ADC1: mute amp left and right */ |
| 8182 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8183 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8184 | /* ADC2: mute amp left and right */ |
| 8185 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8186 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8187 | /* ADC3: mute amp left and right */ |
| 8188 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8189 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8190 | |
| 8191 | { } |
| 8192 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8193 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8194 | /* Macbook 5,1 */ |
| 8195 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8196 | /* DACs */ |
| 8197 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8198 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8199 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8200 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8201 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8202 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8203 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8204 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8205 | /* Surround mixer */ |
| 8206 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8207 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8208 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8209 | /* LFE mixer */ |
| 8210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8211 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8212 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8213 | /* HP mixer */ |
| 8214 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8215 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8216 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8217 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8218 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8219 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8220 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8221 | /* LFE Pin (0x0e) */ |
| 8222 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8223 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8224 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8225 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8226 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8227 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8228 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8229 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8230 | /* Front Mic pin: input vref at 80% */ |
| 8231 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8232 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8233 | /* Line In pin */ |
| 8234 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8235 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8236 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8237 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8238 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8239 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8240 | { } |
| 8241 | }; |
| 8242 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8243 | /* Macmini 3,1 */ |
| 8244 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8245 | /* DACs */ |
| 8246 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8247 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8248 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8249 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8250 | /* Front mixer */ |
| 8251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8253 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8254 | /* Surround mixer */ |
| 8255 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8256 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8257 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8258 | /* LFE mixer */ |
| 8259 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8260 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8261 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8262 | /* HP mixer */ |
| 8263 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8264 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8265 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8266 | /* Front Pin (0x0c) */ |
| 8267 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8268 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8269 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8270 | /* LFE Pin (0x0e) */ |
| 8271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8272 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8273 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8274 | /* HP Pin (0x0f) */ |
| 8275 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8276 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8277 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8278 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8279 | /* Line In pin */ |
| 8280 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8281 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8282 | |
| 8283 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8284 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8285 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8287 | { } |
| 8288 | }; |
| 8289 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8290 | |
| 8291 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8292 | /*Internal and HP Speaker Mixer*/ |
| 8293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8295 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8296 | /*Internal Speaker Pin (0x0c)*/ |
| 8297 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8298 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8299 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8300 | /* HP Pin: output 0 (0x0e) */ |
| 8301 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8302 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8303 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8304 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8305 | /* Line in (is hp when jack connected)*/ |
| 8306 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8307 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8308 | |
| 8309 | { } |
| 8310 | }; |
| 8311 | |
| 8312 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8313 | /* Macbook Pro rev3 */ |
| 8314 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8315 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8316 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8317 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8318 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8319 | /* Rear mixer */ |
| 8320 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8321 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8322 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8323 | /* HP mixer */ |
| 8324 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8325 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8326 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8327 | /* Front Pin: output 0 (0x0c) */ |
| 8328 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8329 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8330 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8331 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8332 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8333 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8334 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8335 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8336 | /* Mic (rear) pin: input vref at 80% */ |
| 8337 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8339 | /* Front Mic pin: input vref at 80% */ |
| 8340 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8341 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8342 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8343 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8344 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8345 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8346 | |
| 8347 | /* FIXME: use matrix-type input source selection */ |
| 8348 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8349 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8350 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8354 | /* Input mixer2 */ |
| 8355 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8356 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8357 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8359 | /* Input mixer3 */ |
| 8360 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8361 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8363 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8364 | /* ADC1: mute amp left and right */ |
| 8365 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8366 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8367 | /* ADC2: mute amp left and right */ |
| 8368 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8369 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8370 | /* ADC3: mute amp left and right */ |
| 8371 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8372 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8373 | |
| 8374 | { } |
| 8375 | }; |
| 8376 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8377 | /* iMac 9,1 */ |
| 8378 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8379 | /* Internal Speaker Pin (0x0c) */ |
| 8380 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8381 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8382 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8383 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8384 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8385 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8386 | /* HP Pin: Rear */ |
| 8387 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8388 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8389 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8390 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8391 | /* Line in Rear */ |
| 8392 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8393 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8394 | /* Front Mic pin: input vref at 80% */ |
| 8395 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8396 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8397 | /* Rear mixer */ |
| 8398 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8400 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8401 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8405 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8406 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8407 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8408 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8409 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8410 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8411 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8412 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8413 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8414 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8415 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8417 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8418 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8419 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8420 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8422 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8423 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8424 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8425 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8426 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8427 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8428 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8429 | { } |
| 8430 | }; |
| 8431 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8432 | /* iMac 24 mixer. */ |
| 8433 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8434 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8435 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8436 | { } /* end */ |
| 8437 | }; |
| 8438 | |
| 8439 | /* iMac 24 init verbs. */ |
| 8440 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8441 | /* Internal speakers: output 0 (0x0c) */ |
| 8442 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8443 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8444 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8445 | /* Internal speakers: output 0 (0x0c) */ |
| 8446 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8447 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8448 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8449 | /* Headphone: output 0 (0x0c) */ |
| 8450 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8451 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8452 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8453 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8454 | /* Front Mic: input vref at 80% */ |
| 8455 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8456 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8457 | { } |
| 8458 | }; |
| 8459 | |
| 8460 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8461 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8462 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8463 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8464 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8465 | spec->autocfg.hp_pins[0] = 0x14; |
| 8466 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8467 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8468 | } |
| 8469 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8470 | #define alc885_mb5_setup alc885_imac24_setup |
| 8471 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8472 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8473 | /* Macbook Air 2,1 */ |
| 8474 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8475 | { |
| 8476 | struct alc_spec *spec = codec->spec; |
| 8477 | |
| 8478 | spec->autocfg.hp_pins[0] = 0x14; |
| 8479 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8480 | } |
| 8481 | |
| 8482 | |
| 8483 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8484 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8485 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8486 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8487 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8488 | spec->autocfg.hp_pins[0] = 0x15; |
| 8489 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8490 | } |
| 8491 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8492 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8493 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8494 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8495 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8496 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8497 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8498 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8499 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8500 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8501 | static struct hda_verb alc882_targa_verbs[] = { |
| 8502 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8504 | |
| 8505 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8506 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8507 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8508 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8509 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8510 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8511 | |
| 8512 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8513 | { } /* end */ |
| 8514 | }; |
| 8515 | |
| 8516 | /* toggle speaker-output according to the hp-jack state */ |
| 8517 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8518 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8519 | struct alc_spec *spec = codec->spec; |
| 8520 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8521 | 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] | 8522 | spec->jack_present ? 1 : 3); |
| 8523 | } |
| 8524 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8525 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8526 | { |
| 8527 | struct alc_spec *spec = codec->spec; |
| 8528 | |
| 8529 | spec->autocfg.hp_pins[0] = 0x14; |
| 8530 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8531 | } |
| 8532 | |
| 8533 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8534 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8535 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8536 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8537 | } |
| 8538 | |
| 8539 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8541 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8542 | |
| 8543 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8544 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8545 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8546 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8547 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8548 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8549 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8550 | |
| 8551 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8552 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8553 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8554 | { } /* end */ |
| 8555 | }; |
| 8556 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8557 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8558 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8559 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8560 | |
| 8561 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8562 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8563 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8564 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8565 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8566 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8567 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8568 | |
| 8569 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8570 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8571 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8572 | { } /* end */ |
| 8573 | }; |
| 8574 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8575 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8576 | { |
| 8577 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8578 | |
| 8579 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8580 | AC_VERB_GET_GPIO_DATA, 0); |
| 8581 | |
| 8582 | if (!muted) |
| 8583 | gpiostate |= (1 << pin); |
| 8584 | else |
| 8585 | gpiostate &= ~(1 << pin); |
| 8586 | |
| 8587 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8588 | AC_VERB_GET_GPIO_MASK, 0); |
| 8589 | gpiomask |= (1 << pin); |
| 8590 | |
| 8591 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8592 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8593 | gpiodir |= (1 << pin); |
| 8594 | |
| 8595 | |
| 8596 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8597 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8598 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8599 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8600 | |
| 8601 | msleep(1); |
| 8602 | |
| 8603 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8604 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8605 | } |
| 8606 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8607 | /* set up GPIO at initialization */ |
| 8608 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8609 | { |
| 8610 | alc882_gpio_mute(codec, 0, 0); |
| 8611 | alc882_gpio_mute(codec, 1, 0); |
| 8612 | } |
| 8613 | |
| 8614 | /* set up GPIO and update auto-muting at initialization */ |
| 8615 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8616 | { |
| 8617 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8618 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8619 | } |
| 8620 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8621 | /* |
| 8622 | * generic initialization of ADC, input mixers and output mixers |
| 8623 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8624 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8625 | /* |
| 8626 | * Unmute ADC0-2 and set the default input to mic-in |
| 8627 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8628 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8629 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8630 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8631 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8632 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8633 | /* |
| 8634 | * Set up output mixers (0x0c - 0x0f) |
| 8635 | */ |
| 8636 | /* set vol=0 to output mixers */ |
| 8637 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8638 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8639 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8640 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8641 | /* set up input amps for analog loopback */ |
| 8642 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8643 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8645 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8646 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8647 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8648 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8649 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8650 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8651 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8652 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8653 | |
| 8654 | /* FIXME: use matrix-type input source selection */ |
| 8655 | /* 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] | 8656 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8657 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8658 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8659 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8660 | { } |
| 8661 | }; |
| 8662 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8663 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8664 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8665 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8666 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8667 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8668 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8669 | { } /* end */ |
| 8670 | }; |
| 8671 | |
| 8672 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8673 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8674 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8675 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8676 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8677 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8678 | { } /* end */ |
| 8679 | }; |
| 8680 | |
| 8681 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8682 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8683 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8684 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8685 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8686 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8687 | { } /* end */ |
| 8688 | }; |
| 8689 | |
| 8690 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8691 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8692 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8693 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8694 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8695 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8696 | { } /* end */ |
| 8697 | }; |
| 8698 | |
| 8699 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8700 | { 2, alc889A_mb31_ch2_init }, |
| 8701 | { 4, alc889A_mb31_ch4_init }, |
| 8702 | { 5, alc889A_mb31_ch5_init }, |
| 8703 | { 6, alc889A_mb31_ch6_init }, |
| 8704 | }; |
| 8705 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8706 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8707 | /* eanable EAPD on medion laptop */ |
| 8708 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8709 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8710 | { } |
| 8711 | }; |
| 8712 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8713 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8714 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8715 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8716 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8717 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 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", 0x15, 0x0, HDA_OUTPUT), |
| 8723 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8724 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8725 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8726 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8727 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8728 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8729 | { } /* end */ |
| 8730 | }; |
| 8731 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8732 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8733 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8734 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8735 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8736 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8737 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8738 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8739 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8740 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8741 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8742 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8743 | { } /* end */ |
| 8744 | }; |
| 8745 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8746 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8747 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8748 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8749 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8750 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8751 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8752 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8753 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8754 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8755 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8756 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8757 | { } /* end */ |
| 8758 | }; |
| 8759 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8760 | static struct snd_kcontrol_new alc883_3ST_2ch_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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8764 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8765 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8766 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8767 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8768 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8769 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8771 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8772 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8773 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8774 | { } /* end */ |
| 8775 | }; |
| 8776 | |
| 8777 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8779 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8780 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8781 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8782 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8783 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8784 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8785 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8786 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8787 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8788 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8789 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8790 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8791 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8792 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8794 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8795 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8796 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8797 | { } /* end */ |
| 8798 | }; |
| 8799 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8800 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8801 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8802 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8803 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8804 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8805 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8806 | HDA_OUTPUT), |
| 8807 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8808 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8809 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8810 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8811 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8812 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8813 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8814 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8816 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8817 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8818 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8819 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8820 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8821 | { } /* end */ |
| 8822 | }; |
| 8823 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8824 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8825 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8826 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8827 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8828 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8829 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8830 | HDA_OUTPUT), |
| 8831 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8832 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8833 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8834 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8835 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8837 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8838 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8840 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8841 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8842 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8843 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8844 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8845 | { } /* end */ |
| 8846 | }; |
| 8847 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8848 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8849 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8850 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8851 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8852 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8853 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8854 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8855 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8856 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8857 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8858 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8859 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8860 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8861 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8862 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8863 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8864 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8865 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8866 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8867 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8868 | { } /* end */ |
| 8869 | }; |
| 8870 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8871 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8872 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8873 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8874 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8875 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8876 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8877 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8878 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8879 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8880 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8881 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8885 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8886 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8887 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8888 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8889 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8890 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8891 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8892 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8894 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8896 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8897 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8898 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8899 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8900 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8901 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8902 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8903 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8904 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8905 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8906 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8907 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8908 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8909 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8910 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8911 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8912 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8913 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8914 | { } /* end */ |
| 8915 | }; |
| 8916 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8917 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8918 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8919 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8920 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8921 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8922 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8924 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8926 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8927 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8928 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8929 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8930 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8931 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8932 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8933 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8934 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8936 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 8937 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8938 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8939 | { } /* end */ |
| 8940 | }; |
| 8941 | |
| 8942 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8943 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8944 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8945 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8946 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8947 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8950 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8951 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8952 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8953 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8954 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8955 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8956 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8957 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8958 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8959 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8960 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8961 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8962 | { } /* end */ |
| 8963 | }; |
| 8964 | |
| 8965 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8966 | /* Unmute front mixer */ |
| 8967 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8969 | |
| 8970 | /* Set speaker pin to front mixer */ |
| 8971 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8972 | |
| 8973 | /* Init headphone pin */ |
| 8974 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8975 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8976 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8977 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8978 | |
| 8979 | { } /* end */ |
| 8980 | }; |
| 8981 | |
| 8982 | /* toggle speaker-output according to the hp-jack state */ |
| 8983 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8984 | { |
| 8985 | struct alc_spec *spec = codec->spec; |
| 8986 | |
| 8987 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8988 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8989 | } |
| 8990 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8991 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8992 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8993 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8998 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8999 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9000 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9001 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9002 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9003 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9004 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9005 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9006 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9007 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9008 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9009 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9010 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9011 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9013 | { } /* end */ |
| 9014 | }; |
| 9015 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9016 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9017 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9018 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9019 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9020 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9021 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9022 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9023 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9024 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9025 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9026 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9027 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9028 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9029 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9030 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9031 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9032 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9033 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9034 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9035 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9036 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9037 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9038 | { } /* end */ |
| 9039 | }; |
| 9040 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9041 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9042 | /* Output mixers */ |
| 9043 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9044 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9045 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9046 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9047 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9048 | HDA_OUTPUT), |
| 9049 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9050 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9051 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9052 | /* Output switches */ |
| 9053 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9054 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9055 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9056 | /* Boost mixers */ |
| 9057 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 9058 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 9059 | /* Input mixers */ |
| 9060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9062 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9063 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9064 | { } /* end */ |
| 9065 | }; |
| 9066 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9067 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9068 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9069 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9070 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9071 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9072 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 9073 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9074 | { } /* end */ |
| 9075 | }; |
| 9076 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9077 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9078 | .ops = &snd_hda_bind_vol, |
| 9079 | .values = { |
| 9080 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9081 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9082 | 0 |
| 9083 | }, |
| 9084 | }; |
| 9085 | |
| 9086 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9087 | .ops = &snd_hda_bind_sw, |
| 9088 | .values = { |
| 9089 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9090 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9091 | 0 |
| 9092 | }, |
| 9093 | }; |
| 9094 | |
| 9095 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9096 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9097 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9098 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9099 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9100 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9101 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9102 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9103 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9104 | { } /* end */ |
| 9105 | }; |
| 9106 | |
| 9107 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9108 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9109 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9110 | { |
| 9111 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9112 | /* .name = "Capture Source", */ |
| 9113 | .name = "Input Source", |
| 9114 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9115 | .info = alc_mux_enum_info, |
| 9116 | .get = alc_mux_enum_get, |
| 9117 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9118 | }, |
| 9119 | { } /* end */ |
| 9120 | }; |
| 9121 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9122 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9123 | { |
| 9124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9125 | .name = "Channel Mode", |
| 9126 | .info = alc_ch_mode_info, |
| 9127 | .get = alc_ch_mode_get, |
| 9128 | .put = alc_ch_mode_put, |
| 9129 | }, |
| 9130 | { } /* end */ |
| 9131 | }; |
| 9132 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9133 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9134 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9135 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9136 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9137 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9138 | spec->autocfg.hp_pins[0] = 0x15; |
| 9139 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9140 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9141 | } |
| 9142 | |
| 9143 | /* auto-toggle front mic */ |
| 9144 | /* |
| 9145 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 9146 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9147 | 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] | 9148 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9149 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 9150 | } |
| 9151 | */ |
| 9152 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9153 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9154 | /* HP */ |
| 9155 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9156 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9157 | /* Subwoofer */ |
| 9158 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9159 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9160 | |
| 9161 | /* enable unsolicited event */ |
| 9162 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9163 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9164 | |
| 9165 | { } /* end */ |
| 9166 | }; |
| 9167 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9168 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9169 | /* HP */ |
| 9170 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9171 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9172 | /* Int speaker */ |
| 9173 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9174 | |
| 9175 | /* enable unsolicited event */ |
| 9176 | /* |
| 9177 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9178 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9179 | */ |
| 9180 | |
| 9181 | { } /* end */ |
| 9182 | }; |
| 9183 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9184 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9185 | /* HP */ |
| 9186 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9188 | /* Int speaker */ |
| 9189 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9190 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9191 | |
| 9192 | /* enable unsolicited event */ |
| 9193 | {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] | 9194 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9195 | |
| 9196 | { } /* end */ |
| 9197 | }; |
| 9198 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9199 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9200 | /* HP */ |
| 9201 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9202 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9203 | /* Subwoofer */ |
| 9204 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9205 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9206 | |
| 9207 | /* enable unsolicited event */ |
| 9208 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9209 | |
| 9210 | { } /* end */ |
| 9211 | }; |
| 9212 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9213 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9214 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9216 | |
| 9217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9219 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9220 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9221 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9222 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9223 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9224 | /* Connect Mic jack to CLFE */ |
| 9225 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9226 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9227 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9228 | /* Connect Line-in jack to Surround */ |
| 9229 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9230 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9231 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9232 | /* Connect HP out jack to Front */ |
| 9233 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9234 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9235 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9236 | |
| 9237 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9238 | |
| 9239 | { } /* end */ |
| 9240 | }; |
| 9241 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9242 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9243 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9244 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9245 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9246 | { } /* end */ |
| 9247 | }; |
| 9248 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9249 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9250 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9251 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9252 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9253 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9254 | { } /* end */ |
| 9255 | }; |
| 9256 | |
| 9257 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9258 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9259 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9260 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9261 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9262 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9263 | { } /* end */ |
| 9264 | }; |
| 9265 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9266 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9267 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9268 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9269 | |
| 9270 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9271 | |
| 9272 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9273 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9274 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9276 | { } /* end */ |
| 9277 | }; |
| 9278 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9279 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9282 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9283 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9284 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9285 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9286 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9287 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9288 | { } /* end */ |
| 9289 | }; |
| 9290 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9291 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9292 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9293 | { } |
| 9294 | }; |
| 9295 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9296 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9297 | /* HP */ |
| 9298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9299 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9300 | |
| 9301 | /* enable unsolicited event */ |
| 9302 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9303 | |
| 9304 | { } /* end */ |
| 9305 | }; |
| 9306 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9307 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9308 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9309 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9310 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9311 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9312 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9313 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9314 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9315 | } |
| 9316 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9317 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9318 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9319 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9320 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9321 | {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] | 9322 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9323 | }; |
| 9324 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9325 | /* |
| 9326 | * 2ch mode |
| 9327 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9328 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9329 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9330 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9331 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9332 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9333 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9334 | }; |
| 9335 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9336 | /* |
| 9337 | * 4ch mode |
| 9338 | */ |
| 9339 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9340 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9341 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9342 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9343 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9344 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9345 | { } /* end */ |
| 9346 | }; |
| 9347 | |
| 9348 | /* |
| 9349 | * 6ch mode |
| 9350 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9351 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9352 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9353 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9354 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9355 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9356 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9357 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9358 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9359 | }; |
| 9360 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9361 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9362 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9363 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9364 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9365 | }; |
| 9366 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9367 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9368 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9369 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9370 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9371 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9372 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9373 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9374 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9375 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9376 | } |
| 9377 | |
| 9378 | /* toggle RCA according to the front-jack state */ |
| 9379 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9380 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9381 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9382 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9383 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9384 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9385 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9386 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9387 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9388 | unsigned int res) |
| 9389 | { |
| 9390 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9391 | alc888_lenovo_ms7195_front_automute(codec); |
| 9392 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9393 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9394 | } |
| 9395 | |
| 9396 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9397 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9398 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9399 | |
| 9400 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9401 | |
| 9402 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9403 | { } /* end */ |
| 9404 | }; |
| 9405 | |
| 9406 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9407 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9408 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9409 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9410 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9411 | spec->autocfg.hp_pins[0] = 0x14; |
| 9412 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9413 | } |
| 9414 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9415 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9416 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9417 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9418 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9419 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9420 | { |
| 9421 | unsigned int present; |
| 9422 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9423 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9424 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9425 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9426 | } |
| 9427 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9428 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9429 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9430 | struct alc_spec *spec = codec->spec; |
| 9431 | |
| 9432 | spec->autocfg.hp_pins[0] = 0x15; |
| 9433 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9434 | } |
| 9435 | |
| 9436 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9437 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9438 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9439 | alc883_clevo_m720_mic_automute(codec); |
| 9440 | } |
| 9441 | |
| 9442 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9443 | unsigned int res) |
| 9444 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9445 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9446 | case ALC880_MIC_EVENT: |
| 9447 | alc883_clevo_m720_mic_automute(codec); |
| 9448 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9449 | default: |
| 9450 | alc_automute_amp_unsol_event(codec, res); |
| 9451 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9452 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9453 | } |
| 9454 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9455 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9456 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9457 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9458 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9459 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9460 | spec->autocfg.hp_pins[0] = 0x14; |
| 9461 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9462 | } |
| 9463 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9464 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9465 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9466 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9467 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9468 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9469 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9470 | } |
| 9471 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9472 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9473 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9474 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9475 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9476 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9477 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9478 | } |
| 9479 | |
| 9480 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9481 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9482 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9483 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9484 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9485 | HDA_AMP_MUTE, bits); |
| 9486 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9487 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9488 | } |
| 9489 | |
| 9490 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9491 | unsigned int res) |
| 9492 | { |
| 9493 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9494 | alc883_lenovo_101e_all_automute(codec); |
| 9495 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9496 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9497 | } |
| 9498 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9499 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9500 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9501 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9502 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9503 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9504 | spec->autocfg.hp_pins[0] = 0x14; |
| 9505 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9506 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9507 | } |
| 9508 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9509 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9510 | /* HP Pin: output 0 (0x0c) */ |
| 9511 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9512 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9513 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9514 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9515 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9516 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9517 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9518 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9519 | /* eanable EAPD on medion laptop */ |
| 9520 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9521 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9522 | /* enable unsolicited event */ |
| 9523 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9524 | { } |
| 9525 | }; |
| 9526 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9527 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9528 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9529 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9530 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9531 | { } /* end */ |
| 9532 | }; |
| 9533 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9534 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9535 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9536 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9537 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9538 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9539 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9540 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9541 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9542 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9543 | } |
| 9544 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9545 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9546 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9547 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9548 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9549 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9550 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9551 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9552 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9553 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9554 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9555 | } |
| 9556 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9557 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9558 | { |
| 9559 | struct alc_spec *spec = codec->spec; |
| 9560 | |
| 9561 | spec->autocfg.hp_pins[0] = 0x15; |
| 9562 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9563 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9564 | } |
| 9565 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9566 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9567 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9568 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9569 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9570 | /* enable unsolicited event */ |
| 9571 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9572 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9573 | { } /* end */ |
| 9574 | }; |
| 9575 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9576 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9577 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9578 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9579 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9580 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9581 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9582 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9583 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9584 | spec->ext_mic.pin = 0x18; |
| 9585 | spec->int_mic.pin = 0x19; |
| 9586 | spec->ext_mic.mux_idx = 0; |
| 9587 | spec->int_mic.mux_idx = 1; |
| 9588 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9589 | } |
| 9590 | |
| 9591 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9592 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9593 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9594 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9595 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9596 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9597 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9598 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9599 | /* enable unsolicited event */ |
| 9600 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9601 | { } /* end */ |
| 9602 | }; |
| 9603 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9604 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9605 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9606 | struct alc_spec *spec = codec->spec; |
| 9607 | |
| 9608 | spec->autocfg.hp_pins[0] = 0x14; |
| 9609 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9610 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9611 | } |
| 9612 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9613 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9614 | /* Init rear pin (used as headphone output) */ |
| 9615 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9616 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9617 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9618 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9619 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9620 | /* Init line 2 pin (used as headphone out by default) */ |
| 9621 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9622 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9623 | { } /* end */ |
| 9624 | }; |
| 9625 | |
| 9626 | /* Mute speakers according to the headphone jack state */ |
| 9627 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9628 | { |
| 9629 | unsigned int present; |
| 9630 | |
| 9631 | /* Mute only in 2ch or 4ch mode */ |
| 9632 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9633 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9634 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9635 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9636 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9637 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9638 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9639 | } |
| 9640 | } |
| 9641 | |
| 9642 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9643 | { |
| 9644 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9645 | alc889A_mb31_automute(codec); |
| 9646 | } |
| 9647 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9648 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9649 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9650 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9651 | #endif |
| 9652 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9653 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9654 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9655 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9656 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9657 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9658 | |
| 9659 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9660 | ALC1200_DIGOUT_NID, 0, |
| 9661 | }; |
| 9662 | |
| 9663 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9664 | ALC883_DIGOUT_NID, 0, |
| 9665 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9666 | |
| 9667 | /* |
| 9668 | * configuration and preset |
| 9669 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9670 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9671 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9672 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9673 | [ALC882_ARIMA] = "arima", |
| 9674 | [ALC882_W2JC] = "w2jc", |
| 9675 | [ALC882_TARGA] = "targa", |
| 9676 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9677 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9678 | [ALC885_MACPRO] = "macpro", |
| 9679 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9680 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9681 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9682 | [ALC885_MBP3] = "mbp3", |
| 9683 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9684 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9685 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9686 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9687 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9688 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9689 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9690 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9691 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9692 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9693 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9694 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9695 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9696 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9697 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9698 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9699 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9700 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9701 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9702 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9703 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9704 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9705 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9706 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9707 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9708 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9709 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9710 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9711 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9712 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9713 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9714 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9715 | [ALC889A_INTEL] = "intel-alc889a", |
| 9716 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9717 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9718 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9719 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9720 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9721 | }; |
| 9722 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9723 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9724 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9725 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9726 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9727 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9728 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9729 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9730 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9731 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9732 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9733 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9734 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9735 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9736 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9737 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9738 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9739 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9740 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9741 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9742 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9743 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9744 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9745 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9746 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9747 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9748 | /* default Acer -- disabled as it causes more problems. |
| 9749 | * model=auto should work fine now |
| 9750 | */ |
| 9751 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9752 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9753 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9754 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9755 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9756 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9757 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9758 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9759 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9760 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9761 | |
| 9762 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9763 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9764 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9765 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9766 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9767 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9768 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9769 | 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] | 9770 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9771 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9772 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9773 | |
| 9774 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9775 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9776 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9777 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9778 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9779 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9780 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9781 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9782 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9783 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9784 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9785 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9786 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9787 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9788 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9789 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9790 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9791 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9792 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9793 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9794 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9795 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9796 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9797 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9798 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9799 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9800 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9801 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9802 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9803 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9804 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9805 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9806 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9807 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9808 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9809 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9810 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9811 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9812 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9813 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9814 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9815 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9816 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9817 | 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] | 9818 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9819 | 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] | 9820 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9821 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9822 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9823 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9824 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9825 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9826 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9827 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9828 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9829 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9830 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9831 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9832 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9833 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9834 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9835 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9836 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9837 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9838 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9839 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9840 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9841 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9842 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9843 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9844 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9845 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9846 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9847 | {} |
| 9848 | }; |
| 9849 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9850 | /* codec SSID table for Intel Mac */ |
| 9851 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9852 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9853 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9854 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9855 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9856 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9857 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9858 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9859 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9860 | 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] | 9861 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9862 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9863 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9864 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9865 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9867 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9868 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9869 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9870 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9871 | */ |
| 9872 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9874 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9875 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9876 | }; |
| 9877 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9878 | static struct alc_config_preset alc882_presets[] = { |
| 9879 | [ALC882_3ST_DIG] = { |
| 9880 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9881 | .init_verbs = { alc882_base_init_verbs, |
| 9882 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9883 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9884 | .dac_nids = alc882_dac_nids, |
| 9885 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9886 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9887 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9888 | .channel_mode = alc882_ch_modes, |
| 9889 | .need_dac_fix = 1, |
| 9890 | .input_mux = &alc882_capture_source, |
| 9891 | }, |
| 9892 | [ALC882_6ST_DIG] = { |
| 9893 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9894 | .init_verbs = { alc882_base_init_verbs, |
| 9895 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9896 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9897 | .dac_nids = alc882_dac_nids, |
| 9898 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9899 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9900 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9901 | .channel_mode = alc882_sixstack_modes, |
| 9902 | .input_mux = &alc882_capture_source, |
| 9903 | }, |
| 9904 | [ALC882_ARIMA] = { |
| 9905 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9906 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9907 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9908 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9909 | .dac_nids = alc882_dac_nids, |
| 9910 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9911 | .channel_mode = alc882_sixstack_modes, |
| 9912 | .input_mux = &alc882_capture_source, |
| 9913 | }, |
| 9914 | [ALC882_W2JC] = { |
| 9915 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9916 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9917 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9918 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9919 | .dac_nids = alc882_dac_nids, |
| 9920 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9921 | .channel_mode = alc880_threestack_modes, |
| 9922 | .need_dac_fix = 1, |
| 9923 | .input_mux = &alc882_capture_source, |
| 9924 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9925 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9926 | [ALC885_MBA21] = { |
| 9927 | .mixers = { alc885_mba21_mixer }, |
| 9928 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9929 | .num_dacs = 2, |
| 9930 | .dac_nids = alc882_dac_nids, |
| 9931 | .channel_mode = alc885_mba21_ch_modes, |
| 9932 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9933 | .input_mux = &alc882_capture_source, |
| 9934 | .unsol_event = alc_automute_amp_unsol_event, |
| 9935 | .setup = alc885_mba21_setup, |
| 9936 | .init_hook = alc_automute_amp, |
| 9937 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9938 | [ALC885_MBP3] = { |
| 9939 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9940 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9941 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9942 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9943 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9944 | .hp_nid = 0x04, |
| 9945 | .channel_mode = alc885_mbp_4ch_modes, |
| 9946 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9947 | .input_mux = &alc882_capture_source, |
| 9948 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9949 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9950 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9951 | .setup = alc885_mbp3_setup, |
| 9952 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9953 | }, |
| 9954 | [ALC885_MB5] = { |
| 9955 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9956 | .init_verbs = { alc885_mb5_init_verbs, |
| 9957 | alc880_gpio1_init_verbs }, |
| 9958 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9959 | .dac_nids = alc882_dac_nids, |
| 9960 | .channel_mode = alc885_mb5_6ch_modes, |
| 9961 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9962 | .input_mux = &mb5_capture_source, |
| 9963 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9964 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9965 | .unsol_event = alc_automute_amp_unsol_event, |
| 9966 | .setup = alc885_mb5_setup, |
| 9967 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9968 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9969 | [ALC885_MACMINI3] = { |
| 9970 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9971 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9972 | alc880_gpio1_init_verbs }, |
| 9973 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9974 | .dac_nids = alc882_dac_nids, |
| 9975 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9976 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9977 | .input_mux = &macmini3_capture_source, |
| 9978 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9979 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9980 | .unsol_event = alc_automute_amp_unsol_event, |
| 9981 | .setup = alc885_macmini3_setup, |
| 9982 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9983 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9984 | [ALC885_MACPRO] = { |
| 9985 | .mixers = { alc882_macpro_mixer }, |
| 9986 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9987 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9988 | .dac_nids = alc882_dac_nids, |
| 9989 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9990 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9991 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9992 | .channel_mode = alc882_ch_modes, |
| 9993 | .input_mux = &alc882_capture_source, |
| 9994 | .init_hook = alc885_macpro_init_hook, |
| 9995 | }, |
| 9996 | [ALC885_IMAC24] = { |
| 9997 | .mixers = { alc885_imac24_mixer }, |
| 9998 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9999 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10000 | .dac_nids = alc882_dac_nids, |
| 10001 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10002 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10003 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10004 | .channel_mode = alc882_ch_modes, |
| 10005 | .input_mux = &alc882_capture_source, |
| 10006 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10007 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10008 | .init_hook = alc885_imac24_init_hook, |
| 10009 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10010 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10011 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10012 | .init_verbs = { alc885_imac91_init_verbs, |
| 10013 | alc880_gpio1_init_verbs }, |
| 10014 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10015 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10016 | .channel_mode = alc885_mba21_ch_modes, |
| 10017 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10018 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10019 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10020 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10021 | .unsol_event = alc_automute_amp_unsol_event, |
| 10022 | .setup = alc885_imac91_setup, |
| 10023 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10024 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10025 | [ALC882_TARGA] = { |
| 10026 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10027 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10028 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10029 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10030 | .dac_nids = alc882_dac_nids, |
| 10031 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10032 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10033 | .adc_nids = alc882_adc_nids, |
| 10034 | .capsrc_nids = alc882_capsrc_nids, |
| 10035 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10036 | .channel_mode = alc882_3ST_6ch_modes, |
| 10037 | .need_dac_fix = 1, |
| 10038 | .input_mux = &alc882_capture_source, |
| 10039 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10040 | .setup = alc882_targa_setup, |
| 10041 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10042 | }, |
| 10043 | [ALC882_ASUS_A7J] = { |
| 10044 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10045 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10046 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10047 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10048 | .dac_nids = alc882_dac_nids, |
| 10049 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10050 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10051 | .adc_nids = alc882_adc_nids, |
| 10052 | .capsrc_nids = alc882_capsrc_nids, |
| 10053 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10054 | .channel_mode = alc882_3ST_6ch_modes, |
| 10055 | .need_dac_fix = 1, |
| 10056 | .input_mux = &alc882_capture_source, |
| 10057 | }, |
| 10058 | [ALC882_ASUS_A7M] = { |
| 10059 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10060 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10061 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10062 | alc882_asus_a7m_verbs }, |
| 10063 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10064 | .dac_nids = alc882_dac_nids, |
| 10065 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10066 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10067 | .channel_mode = alc880_threestack_modes, |
| 10068 | .need_dac_fix = 1, |
| 10069 | .input_mux = &alc882_capture_source, |
| 10070 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10071 | [ALC883_3ST_2ch_DIG] = { |
| 10072 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10073 | .init_verbs = { alc883_init_verbs }, |
| 10074 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10075 | .dac_nids = alc883_dac_nids, |
| 10076 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10077 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10078 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10079 | .channel_mode = alc883_3ST_2ch_modes, |
| 10080 | .input_mux = &alc883_capture_source, |
| 10081 | }, |
| 10082 | [ALC883_3ST_6ch_DIG] = { |
| 10083 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10084 | .init_verbs = { alc883_init_verbs }, |
| 10085 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10086 | .dac_nids = alc883_dac_nids, |
| 10087 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10088 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10089 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10090 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10091 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10092 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10093 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10094 | [ALC883_3ST_6ch] = { |
| 10095 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10096 | .init_verbs = { alc883_init_verbs }, |
| 10097 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10098 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10099 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10100 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10101 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10102 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10103 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10104 | [ALC883_3ST_6ch_INTEL] = { |
| 10105 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10106 | .init_verbs = { alc883_init_verbs }, |
| 10107 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10108 | .dac_nids = alc883_dac_nids, |
| 10109 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10110 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10111 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10112 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10113 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10114 | .need_dac_fix = 1, |
| 10115 | .input_mux = &alc883_3stack_6ch_intel, |
| 10116 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10117 | [ALC889A_INTEL] = { |
| 10118 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10119 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10120 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10121 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10122 | .dac_nids = alc883_dac_nids, |
| 10123 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10124 | .adc_nids = alc889_adc_nids, |
| 10125 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10126 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10127 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10128 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10129 | .channel_mode = alc889_8ch_intel_modes, |
| 10130 | .capsrc_nids = alc889_capsrc_nids, |
| 10131 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10132 | .setup = alc889_automute_setup, |
| 10133 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10134 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10135 | .need_dac_fix = 1, |
| 10136 | }, |
| 10137 | [ALC889_INTEL] = { |
| 10138 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10139 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10140 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10141 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10142 | .dac_nids = alc883_dac_nids, |
| 10143 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10144 | .adc_nids = alc889_adc_nids, |
| 10145 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10146 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10147 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10148 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10149 | .channel_mode = alc889_8ch_intel_modes, |
| 10150 | .capsrc_nids = alc889_capsrc_nids, |
| 10151 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10152 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10153 | .init_hook = alc889_intel_init_hook, |
| 10154 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10155 | .need_dac_fix = 1, |
| 10156 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10157 | [ALC883_6ST_DIG] = { |
| 10158 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10159 | .init_verbs = { alc883_init_verbs }, |
| 10160 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10161 | .dac_nids = alc883_dac_nids, |
| 10162 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10163 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10164 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10165 | .channel_mode = alc883_sixstack_modes, |
| 10166 | .input_mux = &alc883_capture_source, |
| 10167 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10168 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10169 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10170 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10171 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10172 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10173 | .dac_nids = alc883_dac_nids, |
| 10174 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10175 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10176 | .channel_mode = alc883_3ST_6ch_modes, |
| 10177 | .need_dac_fix = 1, |
| 10178 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10179 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10180 | .setup = alc882_targa_setup, |
| 10181 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10182 | }, |
| 10183 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10184 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10185 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10186 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10187 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10188 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10189 | .adc_nids = alc883_adc_nids_alt, |
| 10190 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10191 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10192 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10193 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10194 | .channel_mode = alc883_3ST_2ch_modes, |
| 10195 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10196 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10197 | .setup = alc882_targa_setup, |
| 10198 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10199 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10200 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10201 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10202 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10203 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10204 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10205 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10206 | .dac_nids = alc883_dac_nids, |
| 10207 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10208 | .adc_nids = alc883_adc_nids_rev, |
| 10209 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10210 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10211 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10212 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10213 | .channel_mode = alc883_4ST_8ch_modes, |
| 10214 | .need_dac_fix = 1, |
| 10215 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10216 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10217 | .setup = alc882_targa_setup, |
| 10218 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10219 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10220 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10221 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10222 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10223 | * and the headphone jack. Turn this on and rely on the |
| 10224 | * standard mute methods whenever the user wants to turn |
| 10225 | * these outputs off. |
| 10226 | */ |
| 10227 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10228 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10229 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10230 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10231 | .channel_mode = alc883_3ST_2ch_modes, |
| 10232 | .input_mux = &alc883_capture_source, |
| 10233 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10234 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10235 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10236 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10237 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10238 | .dac_nids = alc883_dac_nids, |
| 10239 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10240 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10241 | .channel_mode = alc883_3ST_2ch_modes, |
| 10242 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +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 = alc883_acer_aspire_setup, |
| 10245 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10246 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10247 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10248 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10249 | alc883_chmode_mixer }, |
| 10250 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10251 | alc888_acer_aspire_4930g_verbs }, |
| 10252 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10253 | .dac_nids = alc883_dac_nids, |
| 10254 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10255 | .adc_nids = alc883_adc_nids_rev, |
| 10256 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10257 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10258 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10259 | .channel_mode = alc883_3ST_6ch_modes, |
| 10260 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10261 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10262 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10263 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10264 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10265 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10266 | .setup = alc888_acer_aspire_4930g_setup, |
| 10267 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10268 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10269 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10270 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10271 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10272 | alc888_acer_aspire_6530g_verbs }, |
| 10273 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10274 | .dac_nids = alc883_dac_nids, |
| 10275 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10276 | .adc_nids = alc883_adc_nids_rev, |
| 10277 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10278 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10279 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10280 | .channel_mode = alc883_3ST_2ch_modes, |
| 10281 | .num_mux_defs = |
| 10282 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10283 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10284 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10285 | .setup = alc888_acer_aspire_6530g_setup, |
| 10286 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10287 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10288 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10289 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10290 | alc883_chmode_mixer }, |
| 10291 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10292 | alc889_acer_aspire_8930g_verbs, |
| 10293 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10294 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10295 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10296 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10297 | .adc_nids = alc889_adc_nids, |
| 10298 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10299 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10300 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10301 | .channel_mode = alc883_3ST_6ch_modes, |
| 10302 | .need_dac_fix = 1, |
| 10303 | .const_channel_count = 6, |
| 10304 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10305 | ARRAY_SIZE(alc889_capture_sources), |
| 10306 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10307 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10308 | .setup = alc889_acer_aspire_8930g_setup, |
| 10309 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10310 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10311 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10312 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10313 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10314 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10315 | .mixers = { alc883_3ST_6ch_mixer, |
| 10316 | alc883_chmode_mixer }, |
| 10317 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10318 | alc888_acer_aspire_7730G_verbs }, |
| 10319 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10320 | .dac_nids = alc883_dac_nids, |
| 10321 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10322 | .adc_nids = alc883_adc_nids_rev, |
| 10323 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10324 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10325 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10326 | .channel_mode = alc883_3ST_6ch_modes, |
| 10327 | .need_dac_fix = 1, |
| 10328 | .const_channel_count = 6, |
| 10329 | .input_mux = &alc883_capture_source, |
| 10330 | .unsol_event = alc_automute_amp_unsol_event, |
| 10331 | .setup = alc888_acer_aspire_6530g_setup, |
| 10332 | .init_hook = alc_automute_amp, |
| 10333 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10334 | [ALC883_MEDION] = { |
| 10335 | .mixers = { alc883_fivestack_mixer, |
| 10336 | alc883_chmode_mixer }, |
| 10337 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10338 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10339 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10340 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10341 | .adc_nids = alc883_adc_nids_alt, |
| 10342 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10343 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10344 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10345 | .channel_mode = alc883_sixstack_modes, |
| 10346 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10347 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10348 | [ALC883_MEDION_MD2] = { |
| 10349 | .mixers = { alc883_medion_md2_mixer}, |
| 10350 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 10351 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10352 | .dac_nids = alc883_dac_nids, |
| 10353 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10354 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10355 | .channel_mode = alc883_3ST_2ch_modes, |
| 10356 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10357 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10358 | .setup = alc883_medion_md2_setup, |
| 10359 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10360 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10361 | [ALC883_MEDION_WIM2160] = { |
| 10362 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10363 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10364 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10365 | .dac_nids = alc883_dac_nids, |
| 10366 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10367 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10368 | .adc_nids = alc883_adc_nids, |
| 10369 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10370 | .channel_mode = alc883_3ST_2ch_modes, |
| 10371 | .input_mux = &alc883_capture_source, |
| 10372 | .unsol_event = alc_automute_amp_unsol_event, |
| 10373 | .setup = alc883_medion_wim2160_setup, |
| 10374 | .init_hook = alc_automute_amp, |
| 10375 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10376 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10377 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10378 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10379 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10380 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10381 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10382 | .channel_mode = alc883_3ST_2ch_modes, |
| 10383 | .input_mux = &alc883_capture_source, |
| 10384 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10385 | [ALC883_CLEVO_M540R] = { |
| 10386 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10387 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10388 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10389 | .dac_nids = alc883_dac_nids, |
| 10390 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10391 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10392 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10393 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10394 | .need_dac_fix = 1, |
| 10395 | .input_mux = &alc883_capture_source, |
| 10396 | /* This machine has the hardware HP auto-muting, thus |
| 10397 | * we need no software mute via unsol event |
| 10398 | */ |
| 10399 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10400 | [ALC883_CLEVO_M720] = { |
| 10401 | .mixers = { alc883_clevo_m720_mixer }, |
| 10402 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10403 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10404 | .dac_nids = alc883_dac_nids, |
| 10405 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10406 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10407 | .channel_mode = alc883_3ST_2ch_modes, |
| 10408 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10409 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10410 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10411 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10412 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10413 | [ALC883_LENOVO_101E_2ch] = { |
| 10414 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10415 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10416 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10417 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10418 | .adc_nids = alc883_adc_nids_alt, |
| 10419 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10420 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10421 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10422 | .channel_mode = alc883_3ST_2ch_modes, |
| 10423 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10424 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10425 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10426 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10427 | [ALC883_LENOVO_NB0763] = { |
| 10428 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10429 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10430 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10431 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10432 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10433 | .channel_mode = alc883_3ST_2ch_modes, |
| 10434 | .need_dac_fix = 1, |
| 10435 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10436 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10437 | .setup = alc883_medion_md2_setup, |
| 10438 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10439 | }, |
| 10440 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10441 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10442 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10443 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10444 | .dac_nids = alc883_dac_nids, |
| 10445 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10446 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10447 | .channel_mode = alc883_3ST_6ch_modes, |
| 10448 | .need_dac_fix = 1, |
| 10449 | .input_mux = &alc883_capture_source, |
| 10450 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10451 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10452 | }, |
| 10453 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10454 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10455 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10456 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10457 | .dac_nids = alc883_dac_nids, |
| 10458 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10459 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10460 | .channel_mode = alc883_3ST_2ch_modes, |
| 10461 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10462 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10463 | .setup = alc883_haier_w66_setup, |
| 10464 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10465 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10466 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10467 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10468 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10469 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10470 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10471 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10472 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10473 | .need_dac_fix = 1, |
| 10474 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10475 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10476 | .setup = alc888_3st_hp_setup, |
| 10477 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10478 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10479 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10480 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10481 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10482 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10483 | .dac_nids = alc883_dac_nids, |
| 10484 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10485 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10486 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10487 | .channel_mode = alc883_sixstack_modes, |
| 10488 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10489 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10490 | .setup = alc888_6st_dell_setup, |
| 10491 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10492 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10493 | [ALC883_MITAC] = { |
| 10494 | .mixers = { alc883_mitac_mixer }, |
| 10495 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10496 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10497 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10498 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10499 | .channel_mode = alc883_3ST_2ch_modes, |
| 10500 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10501 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10502 | .setup = alc883_mitac_setup, |
| 10503 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10504 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10505 | [ALC883_FUJITSU_PI2515] = { |
| 10506 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10507 | .init_verbs = { alc883_init_verbs, |
| 10508 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10509 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10510 | .dac_nids = alc883_dac_nids, |
| 10511 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10512 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10513 | .channel_mode = alc883_3ST_2ch_modes, |
| 10514 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10515 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10516 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10517 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10518 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10519 | [ALC888_FUJITSU_XA3530] = { |
| 10520 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10521 | .init_verbs = { alc883_init_verbs, |
| 10522 | alc888_fujitsu_xa3530_verbs }, |
| 10523 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10524 | .dac_nids = alc883_dac_nids, |
| 10525 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10526 | .adc_nids = alc883_adc_nids_rev, |
| 10527 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10528 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10529 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10530 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10531 | .num_mux_defs = |
| 10532 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10533 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10534 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10535 | .setup = alc888_fujitsu_xa3530_setup, |
| 10536 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10537 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10538 | [ALC888_LENOVO_SKY] = { |
| 10539 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10540 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10541 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10542 | .dac_nids = alc883_dac_nids, |
| 10543 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10544 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10545 | .channel_mode = alc883_sixstack_modes, |
| 10546 | .need_dac_fix = 1, |
| 10547 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10548 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10549 | .setup = alc888_lenovo_sky_setup, |
| 10550 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10551 | }, |
| 10552 | [ALC888_ASUS_M90V] = { |
| 10553 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10554 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10555 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10556 | .dac_nids = alc883_dac_nids, |
| 10557 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10558 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10559 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10560 | .channel_mode = alc883_3ST_6ch_modes, |
| 10561 | .need_dac_fix = 1, |
| 10562 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10563 | .unsol_event = alc_sku_unsol_event, |
| 10564 | .setup = alc883_mode2_setup, |
| 10565 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10566 | }, |
| 10567 | [ALC888_ASUS_EEE1601] = { |
| 10568 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10569 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10570 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10571 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10572 | .dac_nids = alc883_dac_nids, |
| 10573 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10574 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10575 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10576 | .channel_mode = alc883_3ST_2ch_modes, |
| 10577 | .need_dac_fix = 1, |
| 10578 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10579 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10580 | .init_hook = alc883_eee1601_inithook, |
| 10581 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10582 | [ALC1200_ASUS_P5Q] = { |
| 10583 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10584 | .init_verbs = { alc883_init_verbs }, |
| 10585 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10586 | .dac_nids = alc883_dac_nids, |
| 10587 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10588 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10589 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10590 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10591 | .channel_mode = alc883_sixstack_modes, |
| 10592 | .input_mux = &alc883_capture_source, |
| 10593 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10594 | [ALC889A_MB31] = { |
| 10595 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10596 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10597 | alc880_gpio1_init_verbs }, |
| 10598 | .adc_nids = alc883_adc_nids, |
| 10599 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10600 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10601 | .dac_nids = alc883_dac_nids, |
| 10602 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10603 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10604 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10605 | .input_mux = &alc889A_mb31_capture_source, |
| 10606 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10607 | .unsol_event = alc889A_mb31_unsol_event, |
| 10608 | .init_hook = alc889A_mb31_automute, |
| 10609 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10610 | [ALC883_SONY_VAIO_TT] = { |
| 10611 | .mixers = { alc883_vaiott_mixer }, |
| 10612 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10613 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10614 | .dac_nids = alc883_dac_nids, |
| 10615 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10616 | .channel_mode = alc883_3ST_2ch_modes, |
| 10617 | .input_mux = &alc883_capture_source, |
| 10618 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10619 | .setup = alc883_vaiott_setup, |
| 10620 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10621 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10622 | }; |
| 10623 | |
| 10624 | |
| 10625 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10626 | * Pin config fixes |
| 10627 | */ |
| 10628 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10629 | PINFIX_ABIT_AW9D_MAX, |
| 10630 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10631 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10632 | }; |
| 10633 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10634 | static const struct alc_fixup alc882_fixups[] = { |
| 10635 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10636 | .pins = (const struct alc_pincfg[]) { |
| 10637 | { 0x15, 0x01080104 }, /* side */ |
| 10638 | { 0x16, 0x01011012 }, /* rear */ |
| 10639 | { 0x17, 0x01016011 }, /* clfe */ |
| 10640 | { } |
| 10641 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10642 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10643 | [PINFIX_PB_M5210] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10644 | .verbs = (const struct hda_verb[]) { |
| 10645 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10646 | {} |
| 10647 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10648 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10649 | [PINFIX_ACER_ASPIRE_7736] = { |
| 10650 | .sku = ALC_FIXUP_SKU_IGNORE, |
| 10651 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10652 | }; |
| 10653 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10654 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10655 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10656 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10657 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10658 | {} |
| 10659 | }; |
| 10660 | |
| 10661 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10662 | * BIOS auto configuration |
| 10663 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10664 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10665 | const struct auto_pin_cfg *cfg) |
| 10666 | { |
| 10667 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10668 | } |
| 10669 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10670 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10671 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10672 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10673 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10674 | int idx; |
| 10675 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10676 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10677 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10678 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10679 | if (dac == 0x25) |
| 10680 | idx = 4; |
| 10681 | else if (dac >= 0x02 && dac <= 0x05) |
| 10682 | idx = dac - 2; |
| 10683 | else |
| 10684 | return; |
| 10685 | 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] | 10686 | } |
| 10687 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10688 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10689 | { |
| 10690 | struct alc_spec *spec = codec->spec; |
| 10691 | int i; |
| 10692 | |
| 10693 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10694 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10695 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10696 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10697 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10698 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10699 | } |
| 10700 | } |
| 10701 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10702 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10703 | { |
| 10704 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10705 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10706 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10707 | |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10708 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10709 | pin = spec->autocfg.hp_pins[i]; |
| 10710 | if (!pin) |
| 10711 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10712 | dac = spec->multiout.hp_nid; |
| 10713 | if (!dac) |
| 10714 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10715 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10716 | } |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10717 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10718 | pin = spec->autocfg.speaker_pins[i]; |
| 10719 | if (!pin) |
| 10720 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10721 | dac = spec->multiout.extra_out_nid[0]; |
| 10722 | if (!dac) |
| 10723 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10724 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10725 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10726 | } |
| 10727 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10728 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10729 | { |
| 10730 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10731 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10732 | int i; |
| 10733 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10734 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10735 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10736 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10737 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10738 | snd_hda_codec_write(codec, nid, 0, |
| 10739 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10740 | AMP_OUT_MUTE); |
| 10741 | } |
| 10742 | } |
| 10743 | |
| 10744 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10745 | { |
| 10746 | struct alc_spec *spec = codec->spec; |
| 10747 | int c; |
| 10748 | |
| 10749 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10750 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10751 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10752 | unsigned int mux_idx; |
| 10753 | const struct hda_input_mux *imux; |
| 10754 | int conns, mute, idx, item; |
| 10755 | |
| 10756 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10757 | ARRAY_SIZE(conn_list)); |
| 10758 | if (conns < 0) |
| 10759 | continue; |
| 10760 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10761 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10762 | if (!imux->num_items && mux_idx > 0) |
| 10763 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10764 | for (idx = 0; idx < conns; idx++) { |
| 10765 | /* if the current connection is the selected one, |
| 10766 | * unmute it as default - otherwise mute it |
| 10767 | */ |
| 10768 | mute = AMP_IN_MUTE(idx); |
| 10769 | for (item = 0; item < imux->num_items; item++) { |
| 10770 | if (imux->items[item].index == idx) { |
| 10771 | if (spec->cur_mux[c] == item) |
| 10772 | mute = AMP_IN_UNMUTE(idx); |
| 10773 | break; |
| 10774 | } |
| 10775 | } |
| 10776 | /* check if we have a selector or mixer |
| 10777 | * we could check for the widget type instead, but |
| 10778 | * just check for Amp-In presence (in case of mixer |
| 10779 | * without amp-in there is something wrong, this |
| 10780 | * function shouldn't be used or capsrc nid is wrong) |
| 10781 | */ |
| 10782 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10783 | snd_hda_codec_write(codec, nid, 0, |
| 10784 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10785 | mute); |
| 10786 | else if (mute != AMP_IN_MUTE(idx)) |
| 10787 | snd_hda_codec_write(codec, nid, 0, |
| 10788 | AC_VERB_SET_CONNECT_SEL, |
| 10789 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10790 | } |
| 10791 | } |
| 10792 | } |
| 10793 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10794 | /* add mic boosts if needed */ |
| 10795 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10796 | { |
| 10797 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10798 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 10799 | int i, err; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10800 | hda_nid_t nid; |
| 10801 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10802 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10803 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10804 | break; |
| 10805 | nid = cfg->inputs[i].pin; |
| 10806 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 10807 | char label[32]; |
| 10808 | snprintf(label, sizeof(label), "%s Boost", |
| 10809 | hda_get_autocfg_input_label(codec, cfg, i)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10810 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10811 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10812 | if (err < 0) |
| 10813 | return err; |
| 10814 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10815 | } |
| 10816 | return 0; |
| 10817 | } |
| 10818 | |
| 10819 | /* almost identical with ALC880 parser... */ |
| 10820 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10821 | { |
| 10822 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10823 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10824 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10825 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10826 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10827 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10828 | if (err < 0) |
| 10829 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10830 | if (!spec->autocfg.line_outs) |
| 10831 | return 0; /* can't find valid BIOS pin config */ |
| 10832 | |
| 10833 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10834 | if (err < 0) |
| 10835 | return err; |
| 10836 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10837 | if (err < 0) |
| 10838 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10839 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10840 | "Headphone"); |
| 10841 | if (err < 0) |
| 10842 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10843 | err = alc880_auto_create_extra_out(spec, |
| 10844 | spec->autocfg.speaker_pins[0], |
| 10845 | "Speaker"); |
| 10846 | if (err < 0) |
| 10847 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10848 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10849 | if (err < 0) |
| 10850 | return err; |
| 10851 | |
| 10852 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10853 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10854 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10855 | |
| 10856 | if (spec->kctls.list) |
| 10857 | add_mixer(spec, spec->kctls.list); |
| 10858 | |
| 10859 | add_verb(spec, alc883_auto_init_verbs); |
| 10860 | /* if ADC 0x07 is available, initialize it, too */ |
| 10861 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10862 | add_verb(spec, alc882_adc1_init_verbs); |
| 10863 | |
| 10864 | spec->num_mux_defs = 1; |
| 10865 | spec->input_mux = &spec->private_imux[0]; |
| 10866 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10867 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10868 | |
| 10869 | err = alc_auto_add_mic_boost(codec); |
| 10870 | if (err < 0) |
| 10871 | return err; |
| 10872 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10873 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10874 | } |
| 10875 | |
| 10876 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10877 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10878 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10879 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10880 | alc882_auto_init_multi_out(codec); |
| 10881 | alc882_auto_init_hp_out(codec); |
| 10882 | alc882_auto_init_analog_input(codec); |
| 10883 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10884 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10885 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10886 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10887 | } |
| 10888 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10889 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10890 | { |
| 10891 | struct alc_spec *spec; |
| 10892 | int err, board_config; |
| 10893 | |
| 10894 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10895 | if (spec == NULL) |
| 10896 | return -ENOMEM; |
| 10897 | |
| 10898 | codec->spec = spec; |
| 10899 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10900 | switch (codec->vendor_id) { |
| 10901 | case 0x10ec0882: |
| 10902 | case 0x10ec0885: |
| 10903 | break; |
| 10904 | default: |
| 10905 | /* ALC883 and variants */ |
| 10906 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10907 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10908 | } |
| 10909 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10910 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10911 | alc882_models, |
| 10912 | alc882_cfg_tbl); |
| 10913 | |
| 10914 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10915 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10916 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10917 | |
| 10918 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10919 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10920 | codec->chip_name); |
| 10921 | board_config = ALC882_AUTO; |
| 10922 | } |
| 10923 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10924 | if (board_config == ALC882_AUTO) |
| 10925 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10926 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 10927 | alc_auto_parse_customize_define(codec); |
| 10928 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10929 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10930 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10931 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10932 | if (err < 0) { |
| 10933 | alc_free(codec); |
| 10934 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10935 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10936 | printk(KERN_INFO |
| 10937 | "hda_codec: Cannot set up configuration " |
| 10938 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10939 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10940 | } |
| 10941 | } |
| 10942 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10943 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10944 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10945 | if (err < 0) { |
| 10946 | alc_free(codec); |
| 10947 | return err; |
| 10948 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10949 | } |
| 10950 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10951 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10952 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10953 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10954 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10955 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10956 | /* FIXME: setup DAC5 */ |
| 10957 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10958 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10959 | |
| 10960 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10961 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10962 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10963 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10964 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10965 | spec->num_adc_nids = 0; |
| 10966 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10967 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10968 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10969 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10970 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10971 | unsigned int wcap = get_wcaps(codec, nid); |
| 10972 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10973 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10974 | if (wcap != AC_WID_AUD_IN) |
| 10975 | continue; |
| 10976 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10977 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10978 | if (err < 0) |
| 10979 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10980 | err = snd_hda_get_connections(codec, cap, items, |
| 10981 | ARRAY_SIZE(items)); |
| 10982 | if (err < 0) |
| 10983 | continue; |
| 10984 | for (j = 0; j < imux->num_items; j++) |
| 10985 | if (imux->items[j].index >= err) |
| 10986 | break; |
| 10987 | if (j < imux->num_items) |
| 10988 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10989 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10990 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10991 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10992 | spec->adc_nids = spec->private_adc_nids; |
| 10993 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10994 | } |
| 10995 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10996 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10997 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10998 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10999 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11000 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11001 | if (board_config == ALC882_AUTO) |
| 11002 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 11003 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11004 | spec->vmaster_nid = 0x0c; |
| 11005 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11006 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11007 | if (board_config == ALC882_AUTO) |
| 11008 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11009 | |
| 11010 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11011 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11012 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11013 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11014 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11015 | |
| 11016 | return 0; |
| 11017 | } |
| 11018 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11019 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11020 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11021 | * ALC262 support |
| 11022 | */ |
| 11023 | |
| 11024 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11025 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11026 | |
| 11027 | #define alc262_dac_nids alc260_dac_nids |
| 11028 | #define alc262_adc_nids alc882_adc_nids |
| 11029 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11030 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11031 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11032 | |
| 11033 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11034 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11035 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11036 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11037 | /* ADC0 */ |
| 11038 | 0x09 |
| 11039 | }; |
| 11040 | |
| 11041 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11042 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11043 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11044 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11045 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11052 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11053 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11054 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11055 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11056 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11058 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11059 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11060 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11061 | }; |
| 11062 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11063 | /* update HP, line and mono-out pins according to the master switch */ |
| 11064 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11065 | { |
| 11066 | struct alc_spec *spec = codec->spec; |
| 11067 | int val = spec->master_sw; |
| 11068 | |
| 11069 | /* HP & line-out */ |
| 11070 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11071 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11072 | val ? PIN_HP : 0); |
| 11073 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11074 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11075 | val ? PIN_HP : 0); |
| 11076 | /* mono (speaker) depending on the HP jack sense */ |
| 11077 | val = val && !spec->jack_present; |
| 11078 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11079 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11080 | val ? PIN_OUT : 0); |
| 11081 | } |
| 11082 | |
| 11083 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11084 | { |
| 11085 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11086 | |
| 11087 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11088 | alc262_hp_master_update(codec); |
| 11089 | } |
| 11090 | |
| 11091 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11092 | { |
| 11093 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11094 | return; |
| 11095 | alc262_hp_bpc_automute(codec); |
| 11096 | } |
| 11097 | |
| 11098 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11099 | { |
| 11100 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11101 | |
| 11102 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11103 | alc262_hp_master_update(codec); |
| 11104 | } |
| 11105 | |
| 11106 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11107 | unsigned int res) |
| 11108 | { |
| 11109 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11110 | return; |
| 11111 | alc262_hp_wildwest_automute(codec); |
| 11112 | } |
| 11113 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11114 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11115 | |
| 11116 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11117 | struct snd_ctl_elem_value *ucontrol) |
| 11118 | { |
| 11119 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11120 | struct alc_spec *spec = codec->spec; |
| 11121 | int val = !!*ucontrol->value.integer.value; |
| 11122 | |
| 11123 | if (val == spec->master_sw) |
| 11124 | return 0; |
| 11125 | spec->master_sw = val; |
| 11126 | alc262_hp_master_update(codec); |
| 11127 | return 1; |
| 11128 | } |
| 11129 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11130 | #define ALC262_HP_MASTER_SWITCH \ |
| 11131 | { \ |
| 11132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11133 | .name = "Master Playback Switch", \ |
| 11134 | .info = snd_ctl_boolean_mono_info, \ |
| 11135 | .get = alc262_hp_master_sw_get, \ |
| 11136 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11137 | }, \ |
| 11138 | { \ |
| 11139 | .iface = NID_MAPPING, \ |
| 11140 | .name = "Master Playback Switch", \ |
| 11141 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11142 | } |
| 11143 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11144 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11145 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11146 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11147 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11148 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11149 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11150 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11151 | HDA_OUTPUT), |
| 11152 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11153 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11154 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11156 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11157 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11158 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11159 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11160 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11161 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11162 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11163 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11164 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11165 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11166 | { } /* end */ |
| 11167 | }; |
| 11168 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11169 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11170 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11171 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11172 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11173 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11174 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11175 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11176 | HDA_OUTPUT), |
| 11177 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11178 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11179 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11180 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11181 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11182 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11183 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11184 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11185 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11186 | { } /* end */ |
| 11187 | }; |
| 11188 | |
| 11189 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11190 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11191 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11192 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11193 | { } /* end */ |
| 11194 | }; |
| 11195 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11196 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11197 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11198 | { |
| 11199 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11200 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11201 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11202 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11203 | } |
| 11204 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11205 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11206 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11207 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11208 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11209 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11212 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11213 | { } /* end */ |
| 11214 | }; |
| 11215 | |
| 11216 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11219 | |
| 11220 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11221 | { } |
| 11222 | }; |
| 11223 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11224 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11225 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11227 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11228 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11229 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11230 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11231 | { } /* end */ |
| 11232 | }; |
| 11233 | |
| 11234 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11235 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11236 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11237 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11238 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11239 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11240 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11241 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11242 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11243 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11244 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11245 | {} |
| 11246 | }; |
| 11247 | |
| 11248 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11249 | .num_items = 1, |
| 11250 | .items = { |
| 11251 | { "Line", 0x1 }, |
| 11252 | }, |
| 11253 | }; |
| 11254 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11255 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11256 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11257 | { |
| 11258 | struct alc_spec *spec = codec->spec; |
| 11259 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11260 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11261 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11262 | unsigned int mute; |
| 11263 | |
| 11264 | /* HP */ |
| 11265 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11266 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11267 | HDA_AMP_MUTE, mute); |
| 11268 | /* mute internal speaker per jack sense */ |
| 11269 | if (spec->jack_present) |
| 11270 | mute = HDA_AMP_MUTE; |
| 11271 | if (line_nid) |
| 11272 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11273 | HDA_AMP_MUTE, mute); |
| 11274 | if (speaker_nid && speaker_nid != line_nid) |
| 11275 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11276 | HDA_AMP_MUTE, mute); |
| 11277 | } |
| 11278 | |
| 11279 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11280 | |
| 11281 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11282 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11283 | { |
| 11284 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11285 | struct alc_spec *spec = codec->spec; |
| 11286 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11287 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11288 | if (val == spec->master_sw) |
| 11289 | return 0; |
| 11290 | spec->master_sw = val; |
| 11291 | alc262_hippo_master_update(codec); |
| 11292 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11293 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11294 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11295 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11296 | { \ |
| 11297 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11298 | .name = "Master Playback Switch", \ |
| 11299 | .info = snd_ctl_boolean_mono_info, \ |
| 11300 | .get = alc262_hippo_master_sw_get, \ |
| 11301 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11302 | }, \ |
| 11303 | { \ |
| 11304 | .iface = NID_MAPPING, \ |
| 11305 | .name = "Master Playback Switch", \ |
| 11306 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11307 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11308 | } |
| 11309 | |
| 11310 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11311 | ALC262_HIPPO_MASTER_SWITCH, |
| 11312 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11313 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11314 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11315 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11316 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11317 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11318 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11319 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11320 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11321 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11322 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11323 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11324 | { } /* end */ |
| 11325 | }; |
| 11326 | |
| 11327 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11328 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11329 | ALC262_HIPPO_MASTER_SWITCH, |
| 11330 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11331 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11333 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11336 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11337 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11338 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11339 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11340 | { } /* end */ |
| 11341 | }; |
| 11342 | |
| 11343 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11344 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11345 | { |
| 11346 | struct alc_spec *spec = codec->spec; |
| 11347 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11348 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11349 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11350 | alc262_hippo_master_update(codec); |
| 11351 | } |
| 11352 | |
| 11353 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11354 | { |
| 11355 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11356 | return; |
| 11357 | alc262_hippo_automute(codec); |
| 11358 | } |
| 11359 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11360 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11361 | { |
| 11362 | struct alc_spec *spec = codec->spec; |
| 11363 | |
| 11364 | spec->autocfg.hp_pins[0] = 0x15; |
| 11365 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11366 | } |
| 11367 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11368 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11369 | { |
| 11370 | struct alc_spec *spec = codec->spec; |
| 11371 | |
| 11372 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11373 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11374 | } |
| 11375 | |
| 11376 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11377 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11378 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11379 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11380 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11381 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11382 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11383 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11384 | { } /* end */ |
| 11385 | }; |
| 11386 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11387 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11388 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11389 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11390 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11391 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11392 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11393 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11394 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11395 | { } /* end */ |
| 11396 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11397 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11398 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11399 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11400 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11401 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11402 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11403 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11404 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11405 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11406 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11407 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11408 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11409 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11410 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11411 | { } /* end */ |
| 11412 | }; |
| 11413 | |
| 11414 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11415 | /* Headphone automute */ |
| 11416 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11417 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11418 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11419 | |
| 11420 | /* P11 AUX_IN, white 4-pin connector */ |
| 11421 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11422 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11423 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11424 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11425 | |
| 11426 | {} |
| 11427 | }; |
| 11428 | |
| 11429 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11430 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11431 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11432 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11433 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11434 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11435 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11436 | } |
| 11437 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11438 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11439 | #define alc262_capture_mixer alc882_capture_mixer |
| 11440 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11441 | |
| 11442 | /* |
| 11443 | * generic initialization of ADC, input mixers and output mixers |
| 11444 | */ |
| 11445 | static struct hda_verb alc262_init_verbs[] = { |
| 11446 | /* |
| 11447 | * Unmute ADC0-2 and set the default input to mic-in |
| 11448 | */ |
| 11449 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11450 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11451 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11452 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11453 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11454 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11455 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11456 | /* 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] | 11457 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11458 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11459 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11460 | */ |
| 11461 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11462 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11463 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11464 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11465 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11466 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11467 | |
| 11468 | /* |
| 11469 | * Set up output mixers (0x0c - 0x0e) |
| 11470 | */ |
| 11471 | /* set vol=0 to output mixers */ |
| 11472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11473 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11474 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11475 | /* set up input amps for analog loopback */ |
| 11476 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11477 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11478 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11479 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11480 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11481 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11482 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11483 | |
| 11484 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11485 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11486 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11487 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11488 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11489 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11490 | |
| 11491 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11493 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11494 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11495 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11496 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11497 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11498 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11500 | /* FIXME: use matrix-type input source selection */ |
| 11501 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11502 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11503 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11504 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11505 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11506 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11507 | /* Input mixer2 */ |
| 11508 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11509 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11510 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11511 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11512 | /* Input mixer3 */ |
| 11513 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11514 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11515 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11516 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11517 | |
| 11518 | { } |
| 11519 | }; |
| 11520 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11521 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11522 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11523 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11524 | { } |
| 11525 | }; |
| 11526 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11527 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11528 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11529 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11530 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11531 | |
| 11532 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11533 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11534 | {} |
| 11535 | }; |
| 11536 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11537 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11538 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11539 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11540 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11541 | |
| 11542 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11543 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11544 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11545 | }; |
| 11546 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11547 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11548 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11549 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11550 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11551 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11552 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11553 | { } /* end */ |
| 11554 | }; |
| 11555 | |
| 11556 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11557 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11558 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11559 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11560 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11561 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11562 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11563 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11564 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11565 | {} |
| 11566 | }; |
| 11567 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11568 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11569 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11570 | struct alc_spec *spec = codec->spec; |
| 11571 | |
| 11572 | spec->autocfg.hp_pins[0] = 0x15; |
| 11573 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11574 | spec->ext_mic.pin = 0x18; |
| 11575 | spec->ext_mic.mux_idx = 0; |
| 11576 | spec->int_mic.pin = 0x12; |
| 11577 | spec->int_mic.mux_idx = 9; |
| 11578 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11579 | } |
| 11580 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11581 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11582 | * nec model |
| 11583 | * 0x15 = headphone |
| 11584 | * 0x16 = internal speaker |
| 11585 | * 0x18 = external mic |
| 11586 | */ |
| 11587 | |
| 11588 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11589 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11590 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11591 | |
| 11592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11593 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11594 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11595 | |
| 11596 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11597 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11598 | { } /* end */ |
| 11599 | }; |
| 11600 | |
| 11601 | static struct hda_verb alc262_nec_verbs[] = { |
| 11602 | /* Unmute Speaker */ |
| 11603 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11604 | |
| 11605 | /* Headphone */ |
| 11606 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11607 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11608 | |
| 11609 | /* External mic to headphone */ |
| 11610 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11611 | /* External mic to speaker */ |
| 11612 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11613 | {} |
| 11614 | }; |
| 11615 | |
| 11616 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11617 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11618 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11619 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11620 | */ |
| 11621 | |
| 11622 | #define ALC_HP_EVENT 0x37 |
| 11623 | |
| 11624 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11625 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11627 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11628 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11629 | {} |
| 11630 | }; |
| 11631 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11632 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11633 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11634 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11635 | {} |
| 11636 | }; |
| 11637 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11638 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11639 | /* Front Mic pin: input vref at 50% */ |
| 11640 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11641 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11642 | {} |
| 11643 | }; |
| 11644 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11645 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11646 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11647 | .items = { |
| 11648 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11649 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11650 | { "CD", 0x4 }, |
| 11651 | }, |
| 11652 | }; |
| 11653 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11654 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11655 | .num_items = 5, |
| 11656 | .items = { |
| 11657 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11658 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11659 | { "Line", 0x2 }, |
| 11660 | { "CD", 0x4 }, |
| 11661 | { "AUX IN", 0x6 }, |
| 11662 | }, |
| 11663 | }; |
| 11664 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11665 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11666 | .num_items = 4, |
| 11667 | .items = { |
| 11668 | { "Mic", 0x0 }, |
| 11669 | { "Front Mic", 0x2 }, |
| 11670 | { "Line", 0x1 }, |
| 11671 | { "CD", 0x4 }, |
| 11672 | }, |
| 11673 | }; |
| 11674 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11675 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11676 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11677 | { |
| 11678 | struct alc_spec *spec = codec->spec; |
| 11679 | unsigned int mute; |
| 11680 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11681 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11682 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11683 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11684 | spec->sense_updated = 1; |
| 11685 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11686 | /* unmute internal speaker only if both HPs are unplugged and |
| 11687 | * master switch is on |
| 11688 | */ |
| 11689 | if (spec->jack_present) |
| 11690 | mute = HDA_AMP_MUTE; |
| 11691 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11692 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11693 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11694 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11695 | } |
| 11696 | |
| 11697 | /* unsolicited event for HP jack sensing */ |
| 11698 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11699 | unsigned int res) |
| 11700 | { |
| 11701 | if ((res >> 26) != ALC_HP_EVENT) |
| 11702 | return; |
| 11703 | alc262_fujitsu_automute(codec, 1); |
| 11704 | } |
| 11705 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11706 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11707 | { |
| 11708 | alc262_fujitsu_automute(codec, 1); |
| 11709 | } |
| 11710 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11711 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11712 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11713 | .ops = &snd_hda_bind_vol, |
| 11714 | .values = { |
| 11715 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11716 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11717 | 0 |
| 11718 | }, |
| 11719 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11720 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11721 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11722 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11723 | { |
| 11724 | struct alc_spec *spec = codec->spec; |
| 11725 | unsigned int mute; |
| 11726 | |
| 11727 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11728 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11729 | spec->sense_updated = 1; |
| 11730 | } |
| 11731 | if (spec->jack_present) { |
| 11732 | /* mute internal speaker */ |
| 11733 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11734 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11735 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11736 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11737 | } else { |
| 11738 | /* unmute internal speaker if necessary */ |
| 11739 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11740 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11741 | HDA_AMP_MUTE, mute); |
| 11742 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11743 | HDA_AMP_MUTE, mute); |
| 11744 | } |
| 11745 | } |
| 11746 | |
| 11747 | /* unsolicited event for HP jack sensing */ |
| 11748 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11749 | unsigned int res) |
| 11750 | { |
| 11751 | if ((res >> 26) != ALC_HP_EVENT) |
| 11752 | return; |
| 11753 | alc262_lenovo_3000_automute(codec, 1); |
| 11754 | } |
| 11755 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11756 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11757 | int dir, int idx, long *valp) |
| 11758 | { |
| 11759 | int i, change = 0; |
| 11760 | |
| 11761 | for (i = 0; i < 2; i++, valp++) |
| 11762 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11763 | HDA_AMP_MUTE, |
| 11764 | *valp ? 0 : HDA_AMP_MUTE); |
| 11765 | return change; |
| 11766 | } |
| 11767 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11768 | /* bind hp and internal speaker mute (with plug check) */ |
| 11769 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11770 | struct snd_ctl_elem_value *ucontrol) |
| 11771 | { |
| 11772 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11773 | long *valp = ucontrol->value.integer.value; |
| 11774 | int change; |
| 11775 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11776 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11777 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11778 | if (change) |
| 11779 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11780 | return change; |
| 11781 | } |
| 11782 | |
| 11783 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11784 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11785 | { |
| 11786 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11787 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11788 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11789 | .info = snd_hda_mixer_amp_switch_info, |
| 11790 | .get = snd_hda_mixer_amp_switch_get, |
| 11791 | .put = alc262_fujitsu_master_sw_put, |
| 11792 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11793 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11794 | { |
| 11795 | .iface = NID_MAPPING, |
| 11796 | .name = "Master Playback Switch", |
| 11797 | .private_value = 0x1b, |
| 11798 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11799 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11800 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11801 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11802 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11804 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11805 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11806 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11807 | { } /* end */ |
| 11808 | }; |
| 11809 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11810 | /* bind hp and internal speaker mute (with plug check) */ |
| 11811 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11812 | struct snd_ctl_elem_value *ucontrol) |
| 11813 | { |
| 11814 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11815 | long *valp = ucontrol->value.integer.value; |
| 11816 | int change; |
| 11817 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11818 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11819 | if (change) |
| 11820 | alc262_lenovo_3000_automute(codec, 0); |
| 11821 | return change; |
| 11822 | } |
| 11823 | |
| 11824 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11825 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11826 | { |
| 11827 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11828 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11829 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11830 | .info = snd_hda_mixer_amp_switch_info, |
| 11831 | .get = snd_hda_mixer_amp_switch_get, |
| 11832 | .put = alc262_lenovo_3000_master_sw_put, |
| 11833 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11834 | }, |
| 11835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11837 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11840 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11841 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11842 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11843 | { } /* end */ |
| 11844 | }; |
| 11845 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11846 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11847 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11848 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11849 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11850 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11851 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11852 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11853 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11854 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11855 | { } /* end */ |
| 11856 | }; |
| 11857 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11858 | /* additional init verbs for Benq laptops */ |
| 11859 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11860 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11861 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11862 | {} |
| 11863 | }; |
| 11864 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11865 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11866 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11867 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11868 | |
| 11869 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11870 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11871 | {} |
| 11872 | }; |
| 11873 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11874 | /* Samsung Q1 Ultra Vista model setup */ |
| 11875 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11876 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11877 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11880 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11881 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11882 | { } /* end */ |
| 11883 | }; |
| 11884 | |
| 11885 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11886 | /* output mixer */ |
| 11887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11889 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11890 | /* speaker */ |
| 11891 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11892 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11893 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11894 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11895 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11896 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11897 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11898 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11899 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11900 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11901 | /* internal mic */ |
| 11902 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11903 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11904 | /* ADC, choose mic */ |
| 11905 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11906 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11907 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11908 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11909 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11910 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11911 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11912 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11913 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11914 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11915 | {} |
| 11916 | }; |
| 11917 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11918 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11919 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11920 | { |
| 11921 | struct alc_spec *spec = codec->spec; |
| 11922 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11923 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11924 | mute = 0; |
| 11925 | /* auto-mute only when HP is used as HP */ |
| 11926 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11927 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11928 | if (spec->jack_present) |
| 11929 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11930 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11931 | /* mute/unmute internal speaker */ |
| 11932 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11933 | HDA_AMP_MUTE, mute); |
| 11934 | /* mute/unmute HP */ |
| 11935 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11936 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11937 | } |
| 11938 | |
| 11939 | /* unsolicited event for HP jack sensing */ |
| 11940 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11941 | unsigned int res) |
| 11942 | { |
| 11943 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11944 | return; |
| 11945 | alc262_ultra_automute(codec); |
| 11946 | } |
| 11947 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11948 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11949 | .num_items = 2, |
| 11950 | .items = { |
| 11951 | { "Mic", 0x1 }, |
| 11952 | { "Headphone", 0x7 }, |
| 11953 | }, |
| 11954 | }; |
| 11955 | |
| 11956 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11957 | struct snd_ctl_elem_value *ucontrol) |
| 11958 | { |
| 11959 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11960 | struct alc_spec *spec = codec->spec; |
| 11961 | int ret; |
| 11962 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11963 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11964 | if (!ret) |
| 11965 | return 0; |
| 11966 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11967 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11968 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11969 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11970 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11971 | return ret; |
| 11972 | } |
| 11973 | |
| 11974 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11975 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11976 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11977 | { |
| 11978 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11979 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11980 | .info = alc_mux_enum_info, |
| 11981 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11982 | .put = alc262_ultra_mux_enum_put, |
| 11983 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11984 | { |
| 11985 | .iface = NID_MAPPING, |
| 11986 | .name = "Capture Source", |
| 11987 | .private_value = 0x15, |
| 11988 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11989 | { } /* end */ |
| 11990 | }; |
| 11991 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11992 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11993 | * and thus it's bound with a different mixer. |
| 11994 | * This function returns which mixer amp should be used. |
| 11995 | */ |
| 11996 | static int alc262_check_volbit(hda_nid_t nid) |
| 11997 | { |
| 11998 | if (!nid) |
| 11999 | return 0; |
| 12000 | else if (nid == 0x16) |
| 12001 | return 2; |
| 12002 | else |
| 12003 | return 1; |
| 12004 | } |
| 12005 | |
| 12006 | 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] | 12007 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12008 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12009 | unsigned long val; |
| 12010 | int vbit; |
| 12011 | |
| 12012 | vbit = alc262_check_volbit(nid); |
| 12013 | if (!vbit) |
| 12014 | return 0; |
| 12015 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12016 | return 0; |
| 12017 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12018 | if (vbit == 2) |
| 12019 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12020 | else |
| 12021 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12022 | 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] | 12023 | } |
| 12024 | |
| 12025 | 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] | 12026 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12027 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12028 | unsigned long val; |
| 12029 | |
| 12030 | if (!nid) |
| 12031 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12032 | if (nid == 0x16) |
| 12033 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12034 | else |
| 12035 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12036 | 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] | 12037 | } |
| 12038 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12039 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12040 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12041 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12042 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12043 | const char *pfx; |
| 12044 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12045 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12046 | |
| 12047 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12048 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12049 | spec->multiout.dac_nids[0] = 2; |
| 12050 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12051 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 12052 | pfx = "Master"; |
| 12053 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12054 | pfx = "Speaker"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12055 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) |
| 12056 | pfx = "Headphone"; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12057 | else |
| 12058 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12059 | for (i = 0; i < 2; i++) { |
| 12060 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12061 | if (err < 0) |
| 12062 | return err; |
| 12063 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12064 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12065 | "Speaker", i); |
| 12066 | if (err < 0) |
| 12067 | return err; |
| 12068 | } |
| 12069 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12070 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12071 | "Headphone", i); |
| 12072 | if (err < 0) |
| 12073 | return err; |
| 12074 | } |
| 12075 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12076 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12077 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12078 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12079 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12080 | if (vbits == 1 || vbits == 2) |
| 12081 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12082 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12083 | for (i = 0; i < 2; i++) { |
| 12084 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12085 | &vbits, i); |
| 12086 | if (err < 0) |
| 12087 | return err; |
| 12088 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12089 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12090 | "Speaker", &vbits, i); |
| 12091 | if (err < 0) |
| 12092 | return err; |
| 12093 | } |
| 12094 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12095 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12096 | "Headphone", &vbits, i); |
| 12097 | if (err < 0) |
| 12098 | return err; |
| 12099 | } |
| 12100 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12101 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12102 | } |
| 12103 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12104 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12105 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12106 | |
| 12107 | /* |
| 12108 | * generic initialization of ADC, input mixers and output mixers |
| 12109 | */ |
| 12110 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12111 | /* |
| 12112 | * Unmute ADC0-2 and set the default input to mic-in |
| 12113 | */ |
| 12114 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12115 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12116 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12117 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12118 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12119 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12120 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12121 | /* 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] | 12122 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12123 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12124 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12125 | */ |
| 12126 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12132 | |
| 12133 | /* |
| 12134 | * Set up output mixers (0x0c - 0x0f) |
| 12135 | */ |
| 12136 | /* set vol=0 to output mixers */ |
| 12137 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12138 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12139 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12140 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12141 | /* set up input amps for analog loopback */ |
| 12142 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12143 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12145 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12146 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12147 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12149 | |
| 12150 | /* FIXME: use matrix-type input source selection */ |
| 12151 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12152 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12153 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12154 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12155 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12156 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12157 | /* Input mixer2 */ |
| 12158 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12159 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12160 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12161 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12162 | /* Input mixer3 */ |
| 12163 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12164 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12166 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12167 | |
| 12168 | { } |
| 12169 | }; |
| 12170 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12171 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12172 | /* |
| 12173 | * Unmute ADC0-2 and set the default input to mic-in |
| 12174 | */ |
| 12175 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12176 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12177 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12178 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12179 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12180 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12181 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12182 | /* 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] | 12183 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12184 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12185 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12186 | */ |
| 12187 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12188 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12189 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12190 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12191 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12192 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12193 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12194 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12195 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12196 | /* |
| 12197 | * Set up output mixers (0x0c - 0x0e) |
| 12198 | */ |
| 12199 | /* set vol=0 to output mixers */ |
| 12200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12201 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12202 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12203 | |
| 12204 | /* set up input amps for analog loopback */ |
| 12205 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12206 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12207 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12208 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12209 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12211 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12212 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12213 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12214 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12215 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12216 | |
| 12217 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12218 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12219 | |
| 12220 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12221 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12222 | |
| 12223 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12224 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12225 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12226 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12227 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12228 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12229 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12230 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12231 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12232 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12233 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12234 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12235 | |
| 12236 | |
| 12237 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12238 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12239 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12240 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12241 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12242 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12243 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12244 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12245 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12246 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12247 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12248 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12249 | /* Input mixer2 */ |
| 12250 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12251 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12252 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12253 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12254 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12255 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12256 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12257 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12258 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12259 | /* Input mixer3 */ |
| 12260 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12261 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12262 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12263 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12267 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12268 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12269 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12270 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12271 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12272 | { } |
| 12273 | }; |
| 12274 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12275 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12276 | /* |
| 12277 | * Unmute ADC0-2 and set the default input to mic-in |
| 12278 | */ |
| 12279 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12281 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12282 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12283 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12284 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12285 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12286 | /* 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] | 12287 | * mixer widget |
| 12288 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12289 | * panel mic (mic 2) |
| 12290 | */ |
| 12291 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12296 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12297 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12298 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12299 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12300 | /* |
| 12301 | * Set up output mixers (0x0c - 0x0e) |
| 12302 | */ |
| 12303 | /* set vol=0 to output mixers */ |
| 12304 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12305 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12306 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12307 | |
| 12308 | /* set up input amps for analog loopback */ |
| 12309 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12312 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12313 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12314 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12315 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12316 | |
| 12317 | |
| 12318 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12319 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12320 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12321 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12322 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12323 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12324 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12325 | |
| 12326 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12327 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12328 | |
| 12329 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12330 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12331 | |
| 12332 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12333 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12334 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12335 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12336 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12337 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12338 | |
| 12339 | /* FIXME: use matrix-type input source selection */ |
| 12340 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12341 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12344 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12345 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12346 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12347 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12348 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12349 | /* Input mixer2 */ |
| 12350 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12351 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12352 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12353 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12354 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12355 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12356 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12357 | /* Input mixer3 */ |
| 12358 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12359 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12360 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12361 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12363 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12364 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12365 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12366 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12367 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12368 | { } |
| 12369 | }; |
| 12370 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12371 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12372 | |
| 12373 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12374 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12375 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12376 | |
| 12377 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12378 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12379 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12380 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12381 | |
| 12382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12383 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12384 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12385 | {} |
| 12386 | }; |
| 12387 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12388 | /* |
| 12389 | * Pin config fixes |
| 12390 | */ |
| 12391 | enum { |
| 12392 | PINFIX_FSC_H270, |
| 12393 | }; |
| 12394 | |
| 12395 | static const struct alc_fixup alc262_fixups[] = { |
| 12396 | [PINFIX_FSC_H270] = { |
| 12397 | .pins = (const struct alc_pincfg[]) { |
| 12398 | { 0x14, 0x99130110 }, /* speaker */ |
| 12399 | { 0x15, 0x0221142f }, /* front HP */ |
| 12400 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12401 | { } |
| 12402 | } |
| 12403 | }, |
| 12404 | [PINFIX_PB_M5210] = { |
| 12405 | .verbs = (const struct hda_verb[]) { |
| 12406 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 12407 | {} |
| 12408 | } |
| 12409 | }, |
| 12410 | }; |
| 12411 | |
| 12412 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12413 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12414 | {} |
| 12415 | }; |
| 12416 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12417 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12418 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12419 | #define alc262_loopbacks alc880_loopbacks |
| 12420 | #endif |
| 12421 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12422 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12423 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12424 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12425 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12426 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12427 | |
| 12428 | /* |
| 12429 | * BIOS auto configuration |
| 12430 | */ |
| 12431 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12432 | { |
| 12433 | struct alc_spec *spec = codec->spec; |
| 12434 | int err; |
| 12435 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12436 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12437 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12438 | alc262_ignore); |
| 12439 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12440 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12441 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12442 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12443 | spec->multiout.max_channels = 2; |
| 12444 | spec->no_analog = 1; |
| 12445 | goto dig_only; |
| 12446 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12447 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12448 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12449 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12450 | if (err < 0) |
| 12451 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12452 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12453 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12454 | return err; |
| 12455 | |
| 12456 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12457 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12458 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12459 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12460 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12461 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12462 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12463 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12464 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12465 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12466 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12467 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12468 | err = alc_auto_add_mic_boost(codec); |
| 12469 | if (err < 0) |
| 12470 | return err; |
| 12471 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12472 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12473 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12474 | return 1; |
| 12475 | } |
| 12476 | |
| 12477 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12478 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12479 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12480 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12481 | |
| 12482 | |
| 12483 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12484 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12485 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12486 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12487 | alc262_auto_init_multi_out(codec); |
| 12488 | alc262_auto_init_hp_out(codec); |
| 12489 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12490 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12491 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12492 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12493 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12494 | } |
| 12495 | |
| 12496 | /* |
| 12497 | * configuration and preset |
| 12498 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12499 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12500 | [ALC262_BASIC] = "basic", |
| 12501 | [ALC262_HIPPO] = "hippo", |
| 12502 | [ALC262_HIPPO_1] = "hippo_1", |
| 12503 | [ALC262_FUJITSU] = "fujitsu", |
| 12504 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12505 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12506 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12507 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12508 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12509 | [ALC262_BENQ_T31] = "benq-t31", |
| 12510 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12511 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12512 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12513 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12514 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12515 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12516 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12517 | [ALC262_AUTO] = "auto", |
| 12518 | }; |
| 12519 | |
| 12520 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12521 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12522 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12523 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12524 | ALC262_HP_BPC), |
| 12525 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12526 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12527 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12528 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12529 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12530 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12531 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12532 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12533 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12534 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12535 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12536 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12537 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12538 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12539 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12540 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12541 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12542 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12543 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12544 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12545 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12546 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12547 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12548 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12549 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12550 | #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] | 12551 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12552 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12553 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12554 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12555 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12556 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12557 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12558 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12559 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12560 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12561 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12562 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12563 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12564 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12565 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12566 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12567 | {} |
| 12568 | }; |
| 12569 | |
| 12570 | static struct alc_config_preset alc262_presets[] = { |
| 12571 | [ALC262_BASIC] = { |
| 12572 | .mixers = { alc262_base_mixer }, |
| 12573 | .init_verbs = { alc262_init_verbs }, |
| 12574 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12575 | .dac_nids = alc262_dac_nids, |
| 12576 | .hp_nid = 0x03, |
| 12577 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12578 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12579 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12580 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12581 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12582 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12583 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12584 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12585 | .dac_nids = alc262_dac_nids, |
| 12586 | .hp_nid = 0x03, |
| 12587 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12588 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12589 | .channel_mode = alc262_modes, |
| 12590 | .input_mux = &alc262_capture_source, |
| 12591 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12592 | .setup = alc262_hippo_setup, |
| 12593 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12594 | }, |
| 12595 | [ALC262_HIPPO_1] = { |
| 12596 | .mixers = { alc262_hippo1_mixer }, |
| 12597 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12598 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12599 | .dac_nids = alc262_dac_nids, |
| 12600 | .hp_nid = 0x02, |
| 12601 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12602 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12603 | .channel_mode = alc262_modes, |
| 12604 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12605 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12606 | .setup = alc262_hippo1_setup, |
| 12607 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12608 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12609 | [ALC262_FUJITSU] = { |
| 12610 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12611 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12612 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12613 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12614 | .dac_nids = alc262_dac_nids, |
| 12615 | .hp_nid = 0x03, |
| 12616 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12617 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12618 | .channel_mode = alc262_modes, |
| 12619 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12620 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12621 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12622 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12623 | [ALC262_HP_BPC] = { |
| 12624 | .mixers = { alc262_HP_BPC_mixer }, |
| 12625 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12626 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12627 | .dac_nids = alc262_dac_nids, |
| 12628 | .hp_nid = 0x03, |
| 12629 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12630 | .channel_mode = alc262_modes, |
| 12631 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12632 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12633 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12634 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12635 | [ALC262_HP_BPC_D7000_WF] = { |
| 12636 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12637 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12638 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12639 | .dac_nids = alc262_dac_nids, |
| 12640 | .hp_nid = 0x03, |
| 12641 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12642 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12643 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12644 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12645 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12646 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12647 | [ALC262_HP_BPC_D7000_WL] = { |
| 12648 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12649 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12650 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12651 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12652 | .dac_nids = alc262_dac_nids, |
| 12653 | .hp_nid = 0x03, |
| 12654 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12655 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12656 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12657 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12658 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12659 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12660 | [ALC262_HP_TC_T5735] = { |
| 12661 | .mixers = { alc262_hp_t5735_mixer }, |
| 12662 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12663 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12664 | .dac_nids = alc262_dac_nids, |
| 12665 | .hp_nid = 0x03, |
| 12666 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12667 | .channel_mode = alc262_modes, |
| 12668 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12669 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12670 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12671 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12672 | }, |
| 12673 | [ALC262_HP_RP5700] = { |
| 12674 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12675 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12676 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12677 | .dac_nids = alc262_dac_nids, |
| 12678 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12679 | .channel_mode = alc262_modes, |
| 12680 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12681 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12682 | [ALC262_BENQ_ED8] = { |
| 12683 | .mixers = { alc262_base_mixer }, |
| 12684 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12685 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12686 | .dac_nids = alc262_dac_nids, |
| 12687 | .hp_nid = 0x03, |
| 12688 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12689 | .channel_mode = alc262_modes, |
| 12690 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12691 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12692 | [ALC262_SONY_ASSAMD] = { |
| 12693 | .mixers = { alc262_sony_mixer }, |
| 12694 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12695 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12696 | .dac_nids = alc262_dac_nids, |
| 12697 | .hp_nid = 0x02, |
| 12698 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12699 | .channel_mode = alc262_modes, |
| 12700 | .input_mux = &alc262_capture_source, |
| 12701 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12702 | .setup = alc262_hippo_setup, |
| 12703 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12704 | }, |
| 12705 | [ALC262_BENQ_T31] = { |
| 12706 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12707 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12708 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12709 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12710 | .dac_nids = alc262_dac_nids, |
| 12711 | .hp_nid = 0x03, |
| 12712 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12713 | .channel_mode = alc262_modes, |
| 12714 | .input_mux = &alc262_capture_source, |
| 12715 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12716 | .setup = alc262_hippo_setup, |
| 12717 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12718 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12719 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12720 | .mixers = { alc262_ultra_mixer }, |
| 12721 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12722 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12723 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12724 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12725 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12726 | .channel_mode = alc262_modes, |
| 12727 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12728 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12729 | .capsrc_nids = alc262_capsrc_nids, |
| 12730 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12731 | .unsol_event = alc262_ultra_unsol_event, |
| 12732 | .init_hook = alc262_ultra_automute, |
| 12733 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12734 | [ALC262_LENOVO_3000] = { |
| 12735 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12736 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12737 | alc262_lenovo_3000_unsol_verbs, |
| 12738 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12739 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12740 | .dac_nids = alc262_dac_nids, |
| 12741 | .hp_nid = 0x03, |
| 12742 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12743 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12744 | .channel_mode = alc262_modes, |
| 12745 | .input_mux = &alc262_fujitsu_capture_source, |
| 12746 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12747 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12748 | [ALC262_NEC] = { |
| 12749 | .mixers = { alc262_nec_mixer }, |
| 12750 | .init_verbs = { alc262_nec_verbs }, |
| 12751 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12752 | .dac_nids = alc262_dac_nids, |
| 12753 | .hp_nid = 0x03, |
| 12754 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12755 | .channel_mode = alc262_modes, |
| 12756 | .input_mux = &alc262_capture_source, |
| 12757 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12758 | [ALC262_TOSHIBA_S06] = { |
| 12759 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12760 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12761 | alc262_eapd_verbs }, |
| 12762 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12763 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12764 | .dac_nids = alc262_dac_nids, |
| 12765 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12766 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12767 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12768 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12769 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12770 | .unsol_event = alc_sku_unsol_event, |
| 12771 | .setup = alc262_toshiba_s06_setup, |
| 12772 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12773 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12774 | [ALC262_TOSHIBA_RX1] = { |
| 12775 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12776 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12777 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12778 | .dac_nids = alc262_dac_nids, |
| 12779 | .hp_nid = 0x03, |
| 12780 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12781 | .channel_mode = alc262_modes, |
| 12782 | .input_mux = &alc262_capture_source, |
| 12783 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12784 | .setup = alc262_hippo_setup, |
| 12785 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12786 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12787 | [ALC262_TYAN] = { |
| 12788 | .mixers = { alc262_tyan_mixer }, |
| 12789 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12790 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12791 | .dac_nids = alc262_dac_nids, |
| 12792 | .hp_nid = 0x02, |
| 12793 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12794 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12795 | .channel_mode = alc262_modes, |
| 12796 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12797 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12798 | .setup = alc262_tyan_setup, |
| 12799 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12800 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12801 | }; |
| 12802 | |
| 12803 | static int patch_alc262(struct hda_codec *codec) |
| 12804 | { |
| 12805 | struct alc_spec *spec; |
| 12806 | int board_config; |
| 12807 | int err; |
| 12808 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12809 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12810 | if (spec == NULL) |
| 12811 | return -ENOMEM; |
| 12812 | |
| 12813 | codec->spec = spec; |
| 12814 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12815 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12816 | * under-run |
| 12817 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12818 | { |
| 12819 | int tmp; |
| 12820 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12821 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12822 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12823 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12824 | } |
| 12825 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12826 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12827 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12828 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12829 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12830 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12831 | alc262_models, |
| 12832 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12833 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12834 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12835 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12836 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12837 | board_config = ALC262_AUTO; |
| 12838 | } |
| 12839 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12840 | if (board_config == ALC262_AUTO) |
| 12841 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); |
| 12842 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12843 | if (board_config == ALC262_AUTO) { |
| 12844 | /* automatic parse from the BIOS config */ |
| 12845 | err = alc262_parse_auto_config(codec); |
| 12846 | if (err < 0) { |
| 12847 | alc_free(codec); |
| 12848 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12849 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12850 | printk(KERN_INFO |
| 12851 | "hda_codec: Cannot set up configuration " |
| 12852 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12853 | board_config = ALC262_BASIC; |
| 12854 | } |
| 12855 | } |
| 12856 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12857 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12858 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12859 | if (err < 0) { |
| 12860 | alc_free(codec); |
| 12861 | return err; |
| 12862 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12863 | } |
| 12864 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12865 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12866 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12867 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12868 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12869 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12871 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12872 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12873 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12874 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12875 | int i; |
| 12876 | /* check whether the digital-mic has to be supported */ |
| 12877 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12878 | if (spec->input_mux->items[i].index >= 9) |
| 12879 | break; |
| 12880 | } |
| 12881 | if (i < spec->input_mux->num_items) { |
| 12882 | /* use only ADC0 */ |
| 12883 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12884 | spec->num_adc_nids = 1; |
| 12885 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12886 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12887 | /* all analog inputs */ |
| 12888 | /* check whether NID 0x07 is valid */ |
| 12889 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12890 | |
| 12891 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12892 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12893 | if (wcap != AC_WID_AUD_IN) { |
| 12894 | spec->adc_nids = alc262_adc_nids_alt; |
| 12895 | spec->num_adc_nids = |
| 12896 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12897 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12898 | } else { |
| 12899 | spec->adc_nids = alc262_adc_nids; |
| 12900 | spec->num_adc_nids = |
| 12901 | ARRAY_SIZE(alc262_adc_nids); |
| 12902 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12903 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12904 | } |
| 12905 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12906 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12907 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12908 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12909 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12910 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12911 | if (board_config == ALC262_AUTO) |
| 12912 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); |
| 12913 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12914 | spec->vmaster_nid = 0x0c; |
| 12915 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12916 | codec->patch_ops = alc_patch_ops; |
| 12917 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12918 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 12919 | |
| 12920 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12921 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12922 | if (!spec->loopback.amplist) |
| 12923 | spec->loopback.amplist = alc262_loopbacks; |
| 12924 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12925 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12926 | return 0; |
| 12927 | } |
| 12928 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12929 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12930 | * ALC268 channel source setting (2 channel) |
| 12931 | */ |
| 12932 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12933 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12934 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12935 | static hda_nid_t alc268_dac_nids[2] = { |
| 12936 | /* front, hp */ |
| 12937 | 0x02, 0x03 |
| 12938 | }; |
| 12939 | |
| 12940 | static hda_nid_t alc268_adc_nids[2] = { |
| 12941 | /* ADC0-1 */ |
| 12942 | 0x08, 0x07 |
| 12943 | }; |
| 12944 | |
| 12945 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12946 | /* ADC0 */ |
| 12947 | 0x08 |
| 12948 | }; |
| 12949 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12950 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12951 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12952 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12953 | /* output mixer control */ |
| 12954 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12955 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12956 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12957 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12958 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12959 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12960 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12961 | { } |
| 12962 | }; |
| 12963 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12964 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12965 | /* output mixer control */ |
| 12966 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12967 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12968 | ALC262_HIPPO_MASTER_SWITCH, |
| 12969 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12970 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12971 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12972 | { } |
| 12973 | }; |
| 12974 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12975 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12976 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12977 | .ops = &snd_hda_bind_sw, |
| 12978 | .values = { |
| 12979 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12980 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12981 | 0 |
| 12982 | }, |
| 12983 | }; |
| 12984 | |
| 12985 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12986 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12987 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12988 | { } |
| 12989 | }; |
| 12990 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12991 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12992 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12993 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12994 | { } |
| 12995 | }; |
| 12996 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12997 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12998 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12999 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13000 | { } /* end */ |
| 13001 | }; |
| 13002 | |
| 13003 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13004 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13005 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13006 | .ops = &snd_hda_bind_vol, |
| 13007 | .values = { |
| 13008 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13009 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13010 | 0 |
| 13011 | }, |
| 13012 | }; |
| 13013 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13014 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13015 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13016 | { |
| 13017 | struct alc_spec *spec = codec->spec; |
| 13018 | unsigned int mute; |
| 13019 | |
| 13020 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13021 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13022 | spec->sense_updated = 1; |
| 13023 | } |
| 13024 | if (spec->jack_present) |
| 13025 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13026 | else /* unmute internal speaker if necessary */ |
| 13027 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13028 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13029 | HDA_AMP_MUTE, mute); |
| 13030 | } |
| 13031 | |
| 13032 | |
| 13033 | /* bind hp and internal speaker mute (with plug check) */ |
| 13034 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13035 | struct snd_ctl_elem_value *ucontrol) |
| 13036 | { |
| 13037 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13038 | long *valp = ucontrol->value.integer.value; |
| 13039 | int change; |
| 13040 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13041 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13042 | if (change) |
| 13043 | alc268_acer_automute(codec, 0); |
| 13044 | return change; |
| 13045 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13046 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13047 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13048 | /* output mixer control */ |
| 13049 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13050 | { |
| 13051 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13052 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13053 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13054 | .info = snd_hda_mixer_amp_switch_info, |
| 13055 | .get = snd_hda_mixer_amp_switch_get, |
| 13056 | .put = alc268_acer_master_sw_put, |
| 13057 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13058 | }, |
| 13059 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13060 | { } |
| 13061 | }; |
| 13062 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13063 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13064 | /* output mixer control */ |
| 13065 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13066 | { |
| 13067 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13068 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13069 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13070 | .info = snd_hda_mixer_amp_switch_info, |
| 13071 | .get = snd_hda_mixer_amp_switch_get, |
| 13072 | .put = alc268_acer_master_sw_put, |
| 13073 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13074 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 13075 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13076 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13077 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13078 | { } |
| 13079 | }; |
| 13080 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13081 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13082 | /* output mixer control */ |
| 13083 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13084 | { |
| 13085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13086 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13087 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13088 | .info = snd_hda_mixer_amp_switch_info, |
| 13089 | .get = snd_hda_mixer_amp_switch_get, |
| 13090 | .put = alc268_acer_master_sw_put, |
| 13091 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13092 | }, |
| 13093 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13094 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 13095 | { } |
| 13096 | }; |
| 13097 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13098 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13099 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13100 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13101 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13102 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13103 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13104 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13105 | { } |
| 13106 | }; |
| 13107 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13108 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13109 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13110 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13111 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13112 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13113 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13114 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13115 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13116 | { } |
| 13117 | }; |
| 13118 | |
| 13119 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13120 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13121 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13122 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13123 | |
| 13124 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13125 | unsigned int res) |
| 13126 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13127 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13128 | return; |
| 13129 | alc268_acer_automute(codec, 1); |
| 13130 | } |
| 13131 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13132 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13133 | { |
| 13134 | alc268_acer_automute(codec, 1); |
| 13135 | } |
| 13136 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13137 | /* toggle speaker-output according to the hp-jack state */ |
| 13138 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13139 | { |
| 13140 | unsigned int present; |
| 13141 | unsigned char bits; |
| 13142 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13143 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13144 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13145 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13146 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13147 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13148 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13149 | } |
| 13150 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13151 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13152 | unsigned int res) |
| 13153 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13154 | switch (res >> 26) { |
| 13155 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13156 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13157 | break; |
| 13158 | case ALC880_MIC_EVENT: |
| 13159 | alc_mic_automute(codec); |
| 13160 | break; |
| 13161 | } |
| 13162 | } |
| 13163 | |
| 13164 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13165 | { |
| 13166 | struct alc_spec *spec = codec->spec; |
| 13167 | spec->ext_mic.pin = 0x18; |
| 13168 | spec->ext_mic.mux_idx = 0; |
| 13169 | spec->int_mic.pin = 0x12; |
| 13170 | spec->int_mic.mux_idx = 6; |
| 13171 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13172 | } |
| 13173 | |
| 13174 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13175 | { |
| 13176 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13177 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13178 | } |
| 13179 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13180 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13181 | /* output mixer control */ |
| 13182 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13183 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13184 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13185 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13186 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13187 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13188 | { } |
| 13189 | }; |
| 13190 | |
| 13191 | static struct hda_verb alc268_dell_verbs[] = { |
| 13192 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13194 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13195 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13196 | { } |
| 13197 | }; |
| 13198 | |
| 13199 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13200 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13201 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13202 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13203 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13204 | spec->autocfg.hp_pins[0] = 0x15; |
| 13205 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13206 | spec->ext_mic.pin = 0x18; |
| 13207 | spec->ext_mic.mux_idx = 0; |
| 13208 | spec->int_mic.pin = 0x19; |
| 13209 | spec->int_mic.mux_idx = 1; |
| 13210 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13211 | } |
| 13212 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13213 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13214 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13215 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13216 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13217 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13218 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13219 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13220 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13221 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13222 | { } |
| 13223 | }; |
| 13224 | |
| 13225 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13226 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13227 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13228 | { } |
| 13229 | }; |
| 13230 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13231 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13232 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13233 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13234 | spec->autocfg.hp_pins[0] = 0x15; |
| 13235 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13236 | spec->ext_mic.pin = 0x18; |
| 13237 | spec->ext_mic.mux_idx = 0; |
| 13238 | spec->int_mic.pin = 0x19; |
| 13239 | spec->int_mic.mux_idx = 1; |
| 13240 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13241 | } |
| 13242 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13243 | /* |
| 13244 | * generic initialization of ADC, input mixers and output mixers |
| 13245 | */ |
| 13246 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13247 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13248 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13249 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13250 | |
| 13251 | /* |
| 13252 | * Set up output mixers (0x0c - 0x0e) |
| 13253 | */ |
| 13254 | /* set vol=0 to output mixers */ |
| 13255 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13256 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13257 | |
| 13258 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13259 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13260 | |
| 13261 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13262 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13263 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13264 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13265 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13266 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13267 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13268 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13269 | |
| 13270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13271 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13272 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13273 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13274 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13275 | |
| 13276 | /* set PCBEEP vol = 0, mute connections */ |
| 13277 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13278 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13279 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13280 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13281 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13282 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13283 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13284 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13285 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13287 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13288 | { } |
| 13289 | }; |
| 13290 | |
| 13291 | /* |
| 13292 | * generic initialization of ADC, input mixers and output mixers |
| 13293 | */ |
| 13294 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13295 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13296 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13297 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13298 | |
| 13299 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13300 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13301 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13302 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13303 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13304 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13305 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13306 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13307 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13308 | |
| 13309 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13310 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13311 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13312 | /* set PCBEEP vol = 0, mute connections */ |
| 13313 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13314 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13315 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13316 | |
| 13317 | { } |
| 13318 | }; |
| 13319 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13320 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13321 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13322 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13323 | { } /* end */ |
| 13324 | }; |
| 13325 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13326 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13327 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13328 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13329 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13330 | { } /* end */ |
| 13331 | }; |
| 13332 | |
| 13333 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13334 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13335 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13336 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13337 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13338 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13339 | { } /* end */ |
| 13340 | }; |
| 13341 | |
| 13342 | static struct hda_input_mux alc268_capture_source = { |
| 13343 | .num_items = 4, |
| 13344 | .items = { |
| 13345 | { "Mic", 0x0 }, |
| 13346 | { "Front Mic", 0x1 }, |
| 13347 | { "Line", 0x2 }, |
| 13348 | { "CD", 0x3 }, |
| 13349 | }, |
| 13350 | }; |
| 13351 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13352 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13353 | .num_items = 3, |
| 13354 | .items = { |
| 13355 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13356 | { "Internal Mic", 0x1 }, |
| 13357 | { "Line", 0x2 }, |
| 13358 | }, |
| 13359 | }; |
| 13360 | |
| 13361 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13362 | .num_items = 3, |
| 13363 | .items = { |
| 13364 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13365 | { "Internal Mic", 0x6 }, |
| 13366 | { "Line", 0x2 }, |
| 13367 | }, |
| 13368 | }; |
| 13369 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13370 | #ifdef CONFIG_SND_DEBUG |
| 13371 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13372 | /* Volume widgets */ |
| 13373 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13374 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13375 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13376 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13377 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13378 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13379 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13380 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13381 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13382 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13383 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13384 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13385 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13386 | /* The below appears problematic on some hardwares */ |
| 13387 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13388 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13389 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13390 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13391 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13392 | |
| 13393 | /* Modes for retasking pin widgets */ |
| 13394 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13395 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13396 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13397 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13398 | |
| 13399 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13400 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13401 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13402 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13403 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13404 | |
| 13405 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13406 | * The ALC268 does not have an SPDIF input. |
| 13407 | */ |
| 13408 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13409 | |
| 13410 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13411 | * this output to turn on an external amplifier. |
| 13412 | */ |
| 13413 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13414 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13415 | |
| 13416 | { } /* end */ |
| 13417 | }; |
| 13418 | #endif |
| 13419 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13420 | /* create input playback/capture controls for the given pin */ |
| 13421 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13422 | const char *ctlname, int idx) |
| 13423 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13424 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13425 | int err; |
| 13426 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13427 | switch (nid) { |
| 13428 | case 0x14: |
| 13429 | case 0x16: |
| 13430 | dac = 0x02; |
| 13431 | break; |
| 13432 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13433 | case 0x1a: /* ALC259/269 only */ |
| 13434 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13435 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13436 | dac = 0x03; |
| 13437 | break; |
| 13438 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13439 | snd_printd(KERN_WARNING "hda_codec: " |
| 13440 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13441 | return 0; |
| 13442 | } |
| 13443 | if (spec->multiout.dac_nids[0] != dac && |
| 13444 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13445 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13446 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13447 | HDA_OUTPUT)); |
| 13448 | if (err < 0) |
| 13449 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13450 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13451 | } |
| 13452 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13453 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13454 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13455 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13456 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13457 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13458 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13459 | if (err < 0) |
| 13460 | return err; |
| 13461 | return 0; |
| 13462 | } |
| 13463 | |
| 13464 | /* add playback controls from the parsed DAC table */ |
| 13465 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13466 | const struct auto_pin_cfg *cfg) |
| 13467 | { |
| 13468 | hda_nid_t nid; |
| 13469 | int err; |
| 13470 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13471 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13472 | |
| 13473 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13474 | if (nid) { |
| 13475 | const char *name; |
| 13476 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13477 | name = "Speaker"; |
| 13478 | else |
| 13479 | name = "Front"; |
| 13480 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13481 | if (err < 0) |
| 13482 | return err; |
| 13483 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13484 | |
| 13485 | nid = cfg->speaker_pins[0]; |
| 13486 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13487 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13488 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13489 | if (err < 0) |
| 13490 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13491 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13492 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13493 | if (err < 0) |
| 13494 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13495 | } |
| 13496 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13497 | if (nid) { |
| 13498 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13499 | if (err < 0) |
| 13500 | return err; |
| 13501 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13502 | |
| 13503 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13504 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13505 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13506 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13507 | if (err < 0) |
| 13508 | return err; |
| 13509 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13510 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13511 | } |
| 13512 | |
| 13513 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13514 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13515 | const struct auto_pin_cfg *cfg) |
| 13516 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13517 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13518 | } |
| 13519 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13520 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13521 | hda_nid_t nid, int pin_type) |
| 13522 | { |
| 13523 | int idx; |
| 13524 | |
| 13525 | alc_set_pin_output(codec, nid, pin_type); |
| 13526 | if (nid == 0x14 || nid == 0x16) |
| 13527 | idx = 0; |
| 13528 | else |
| 13529 | idx = 1; |
| 13530 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13531 | } |
| 13532 | |
| 13533 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13534 | { |
| 13535 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13536 | int i; |
| 13537 | |
| 13538 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13539 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13540 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13541 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13542 | } |
| 13543 | } |
| 13544 | |
| 13545 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13546 | { |
| 13547 | struct alc_spec *spec = codec->spec; |
| 13548 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13549 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13550 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13551 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13552 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13553 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13554 | } |
| 13555 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13556 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13557 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13558 | } |
| 13559 | if (spec->autocfg.mono_out_pin) |
| 13560 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13561 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13562 | } |
| 13563 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13564 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13565 | { |
| 13566 | struct alc_spec *spec = codec->spec; |
| 13567 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13568 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13569 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13570 | unsigned int dac_vol1, dac_vol2; |
| 13571 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13572 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13573 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13574 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13575 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13576 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13577 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13578 | AMP_IN_UNMUTE(1)); |
| 13579 | snd_hda_codec_write(codec, 0x10, 0, |
| 13580 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13581 | AMP_IN_UNMUTE(1)); |
| 13582 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13583 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13584 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13585 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13586 | snd_hda_codec_write(codec, 0x10, 0, |
| 13587 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13588 | } |
| 13589 | |
| 13590 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13591 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13592 | dac_vol2 = AMP_OUT_ZERO; |
| 13593 | else if (line_nid == 0x15) |
| 13594 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13595 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13596 | dac_vol2 = AMP_OUT_ZERO; |
| 13597 | else if (hp_nid == 0x15) |
| 13598 | dac_vol1 = AMP_OUT_ZERO; |
| 13599 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13600 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13601 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13602 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13603 | |
| 13604 | snd_hda_codec_write(codec, 0x02, 0, |
| 13605 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13606 | snd_hda_codec_write(codec, 0x03, 0, |
| 13607 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13608 | } |
| 13609 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13610 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13611 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13612 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13613 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13614 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13615 | |
| 13616 | /* |
| 13617 | * BIOS auto configuration |
| 13618 | */ |
| 13619 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13620 | { |
| 13621 | struct alc_spec *spec = codec->spec; |
| 13622 | int err; |
| 13623 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13624 | |
| 13625 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13626 | alc268_ignore); |
| 13627 | if (err < 0) |
| 13628 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13629 | if (!spec->autocfg.line_outs) { |
| 13630 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13631 | spec->multiout.max_channels = 2; |
| 13632 | spec->no_analog = 1; |
| 13633 | goto dig_only; |
| 13634 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13635 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13636 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13637 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13638 | if (err < 0) |
| 13639 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13640 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13641 | if (err < 0) |
| 13642 | return err; |
| 13643 | |
| 13644 | spec->multiout.max_channels = 2; |
| 13645 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13646 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13647 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13648 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13649 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13650 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13651 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13652 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13653 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13654 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13655 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13656 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13657 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13658 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13659 | err = alc_auto_add_mic_boost(codec); |
| 13660 | if (err < 0) |
| 13661 | return err; |
| 13662 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13663 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13664 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13665 | return 1; |
| 13666 | } |
| 13667 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13668 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13669 | |
| 13670 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13671 | static void alc268_auto_init(struct hda_codec *codec) |
| 13672 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13673 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13674 | alc268_auto_init_multi_out(codec); |
| 13675 | alc268_auto_init_hp_out(codec); |
| 13676 | alc268_auto_init_mono_speaker_out(codec); |
| 13677 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13678 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13679 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13680 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13681 | } |
| 13682 | |
| 13683 | /* |
| 13684 | * configuration and preset |
| 13685 | */ |
| 13686 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13687 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13688 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13689 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13690 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13691 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13692 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13693 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13694 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13695 | #ifdef CONFIG_SND_DEBUG |
| 13696 | [ALC268_TEST] = "test", |
| 13697 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13698 | [ALC268_AUTO] = "auto", |
| 13699 | }; |
| 13700 | |
| 13701 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13702 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13703 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13704 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13705 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13706 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13707 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13708 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13709 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13710 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13711 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13712 | /* almost compatible with toshiba but with optional digital outs; |
| 13713 | * auto-probing seems working fine |
| 13714 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13715 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13716 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13717 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13718 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13719 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13720 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13721 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13722 | {} |
| 13723 | }; |
| 13724 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13725 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13726 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13727 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13728 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13729 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13730 | ALC268_TOSHIBA), |
| 13731 | {} |
| 13732 | }; |
| 13733 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13734 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13735 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13736 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13737 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13738 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13739 | alc267_quanta_il1_verbs }, |
| 13740 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13741 | .dac_nids = alc268_dac_nids, |
| 13742 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13743 | .adc_nids = alc268_adc_nids_alt, |
| 13744 | .hp_nid = 0x03, |
| 13745 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13746 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13747 | .unsol_event = alc_sku_unsol_event, |
| 13748 | .setup = alc267_quanta_il1_setup, |
| 13749 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13750 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13751 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13752 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13753 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13754 | .init_verbs = { alc268_base_init_verbs }, |
| 13755 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13756 | .dac_nids = alc268_dac_nids, |
| 13757 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13758 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13759 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13760 | .hp_nid = 0x03, |
| 13761 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13762 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13763 | .channel_mode = alc268_modes, |
| 13764 | .input_mux = &alc268_capture_source, |
| 13765 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13766 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13767 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13768 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13769 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13770 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13771 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13772 | .dac_nids = alc268_dac_nids, |
| 13773 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13774 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13775 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13776 | .hp_nid = 0x03, |
| 13777 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13778 | .channel_mode = alc268_modes, |
| 13779 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13780 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13781 | .setup = alc268_toshiba_setup, |
| 13782 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13783 | }, |
| 13784 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13785 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13786 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13787 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13788 | alc268_acer_verbs }, |
| 13789 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13790 | .dac_nids = alc268_dac_nids, |
| 13791 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13792 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13793 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13794 | .hp_nid = 0x02, |
| 13795 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13796 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13797 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13798 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13799 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13800 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13801 | [ALC268_ACER_DMIC] = { |
| 13802 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13803 | alc268_beep_mixer }, |
| 13804 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13805 | alc268_acer_verbs }, |
| 13806 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13807 | .dac_nids = alc268_dac_nids, |
| 13808 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13809 | .adc_nids = alc268_adc_nids_alt, |
| 13810 | .capsrc_nids = alc268_capsrc_nids, |
| 13811 | .hp_nid = 0x02, |
| 13812 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13813 | .channel_mode = alc268_modes, |
| 13814 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13815 | .unsol_event = alc268_acer_unsol_event, |
| 13816 | .init_hook = alc268_acer_init_hook, |
| 13817 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13818 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13819 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13820 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13821 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13822 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13823 | alc268_acer_aspire_one_verbs }, |
| 13824 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13825 | .dac_nids = alc268_dac_nids, |
| 13826 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13827 | .adc_nids = alc268_adc_nids_alt, |
| 13828 | .capsrc_nids = alc268_capsrc_nids, |
| 13829 | .hp_nid = 0x03, |
| 13830 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13831 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13832 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13833 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13834 | .init_hook = alc268_acer_lc_init_hook, |
| 13835 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13836 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13837 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13838 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13839 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13840 | alc268_dell_verbs }, |
| 13841 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13842 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13843 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13844 | .adc_nids = alc268_adc_nids_alt, |
| 13845 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13846 | .hp_nid = 0x02, |
| 13847 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13848 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13849 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13850 | .setup = alc268_dell_setup, |
| 13851 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13852 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13853 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13854 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13855 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13856 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13857 | alc268_toshiba_verbs }, |
| 13858 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13859 | .dac_nids = alc268_dac_nids, |
| 13860 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13861 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13862 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13863 | .hp_nid = 0x03, |
| 13864 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13865 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13866 | .channel_mode = alc268_modes, |
| 13867 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13868 | .setup = alc268_toshiba_setup, |
| 13869 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13870 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13871 | #ifdef CONFIG_SND_DEBUG |
| 13872 | [ALC268_TEST] = { |
| 13873 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13874 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13875 | alc268_volume_init_verbs }, |
| 13876 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13877 | .dac_nids = alc268_dac_nids, |
| 13878 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13879 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13880 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13881 | .hp_nid = 0x03, |
| 13882 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13883 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13884 | .channel_mode = alc268_modes, |
| 13885 | .input_mux = &alc268_capture_source, |
| 13886 | }, |
| 13887 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13888 | }; |
| 13889 | |
| 13890 | static int patch_alc268(struct hda_codec *codec) |
| 13891 | { |
| 13892 | struct alc_spec *spec; |
| 13893 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13894 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13895 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13896 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13897 | if (spec == NULL) |
| 13898 | return -ENOMEM; |
| 13899 | |
| 13900 | codec->spec = spec; |
| 13901 | |
| 13902 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13903 | alc268_models, |
| 13904 | alc268_cfg_tbl); |
| 13905 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13906 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13907 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13908 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13909 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13910 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13911 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13912 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13913 | board_config = ALC268_AUTO; |
| 13914 | } |
| 13915 | |
| 13916 | if (board_config == ALC268_AUTO) { |
| 13917 | /* automatic parse from the BIOS config */ |
| 13918 | err = alc268_parse_auto_config(codec); |
| 13919 | if (err < 0) { |
| 13920 | alc_free(codec); |
| 13921 | return err; |
| 13922 | } else if (!err) { |
| 13923 | printk(KERN_INFO |
| 13924 | "hda_codec: Cannot set up configuration " |
| 13925 | "from BIOS. Using base mode...\n"); |
| 13926 | board_config = ALC268_3ST; |
| 13927 | } |
| 13928 | } |
| 13929 | |
| 13930 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13931 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13932 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13933 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13934 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13935 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13936 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13937 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13938 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13939 | has_beep = 0; |
| 13940 | for (i = 0; i < spec->num_mixers; i++) { |
| 13941 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13942 | has_beep = 1; |
| 13943 | break; |
| 13944 | } |
| 13945 | } |
| 13946 | |
| 13947 | if (has_beep) { |
| 13948 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13949 | if (err < 0) { |
| 13950 | alc_free(codec); |
| 13951 | return err; |
| 13952 | } |
| 13953 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13954 | /* override the amp caps for beep generator */ |
| 13955 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13956 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13957 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13958 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13959 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13960 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13961 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13962 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13963 | /* check whether NID 0x07 is valid */ |
| 13964 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13965 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13966 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13967 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13968 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13969 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13970 | if (spec->auto_mic || |
| 13971 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13972 | spec->adc_nids = alc268_adc_nids_alt; |
| 13973 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13974 | if (spec->auto_mic) |
| 13975 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13976 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13977 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13978 | else |
| 13979 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13980 | } else { |
| 13981 | spec->adc_nids = alc268_adc_nids; |
| 13982 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13983 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13984 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13985 | /* set default input source */ |
| 13986 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13987 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13988 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13989 | i < spec->num_mux_defs ? |
| 13990 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13991 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13992 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13993 | |
| 13994 | spec->vmaster_nid = 0x02; |
| 13995 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13996 | codec->patch_ops = alc_patch_ops; |
| 13997 | if (board_config == ALC268_AUTO) |
| 13998 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13999 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14000 | alc_init_jacks(codec); |
| 14001 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14002 | return 0; |
| 14003 | } |
| 14004 | |
| 14005 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14006 | * ALC269 channel source setting (2 channel) |
| 14007 | */ |
| 14008 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14009 | |
| 14010 | #define alc269_dac_nids alc260_dac_nids |
| 14011 | |
| 14012 | static hda_nid_t alc269_adc_nids[1] = { |
| 14013 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14014 | 0x08, |
| 14015 | }; |
| 14016 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14017 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14018 | 0x23, |
| 14019 | }; |
| 14020 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14021 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14022 | /* ADC1 */ |
| 14023 | 0x09, |
| 14024 | }; |
| 14025 | |
| 14026 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14027 | 0x22, |
| 14028 | }; |
| 14029 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14030 | static hda_nid_t alc269_adc_candidates[] = { |
| 14031 | 0x08, 0x09, 0x07, |
| 14032 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14033 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14034 | #define alc269_modes alc260_modes |
| 14035 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14036 | |
| 14037 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14038 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14039 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14040 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14041 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14042 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14043 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14044 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14045 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14046 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 14047 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14048 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14049 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14050 | { } /* end */ |
| 14051 | }; |
| 14052 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14053 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14054 | /* output mixer control */ |
| 14055 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14056 | { |
| 14057 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14058 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14059 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14060 | .info = snd_hda_mixer_amp_switch_info, |
| 14061 | .get = snd_hda_mixer_amp_switch_get, |
| 14062 | .put = alc268_acer_master_sw_put, |
| 14063 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14064 | }, |
| 14065 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14066 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14067 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14068 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14069 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 14070 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14071 | { } |
| 14072 | }; |
| 14073 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14074 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14075 | /* output mixer control */ |
| 14076 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14077 | { |
| 14078 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14079 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14080 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14081 | .info = snd_hda_mixer_amp_switch_info, |
| 14082 | .get = snd_hda_mixer_amp_switch_get, |
| 14083 | .put = alc268_acer_master_sw_put, |
| 14084 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14085 | }, |
| 14086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14087 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14088 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14089 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14090 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 14091 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 14092 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14093 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 14094 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14095 | { } |
| 14096 | }; |
| 14097 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14098 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14099 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14100 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14101 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14102 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14103 | { } /* end */ |
| 14104 | }; |
| 14105 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14106 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14107 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14108 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14109 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14110 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14111 | { } /* end */ |
| 14112 | }; |
| 14113 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14114 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14115 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14116 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14117 | { } /* end */ |
| 14118 | }; |
| 14119 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14120 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14121 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14122 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14123 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 14124 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14125 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 14126 | { } /* end */ |
| 14127 | }; |
| 14128 | |
| 14129 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14130 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14131 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14132 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14133 | { } /* end */ |
| 14134 | }; |
| 14135 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14136 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14137 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14138 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14139 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14140 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 14141 | { } /* end */ |
| 14142 | }; |
| 14143 | |
| 14144 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14145 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14146 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14147 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14148 | { } /* end */ |
| 14149 | }; |
| 14150 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14151 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14152 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14153 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14154 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14155 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14156 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14157 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14158 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14159 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14160 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14161 | { } |
| 14162 | }; |
| 14163 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14164 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14165 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14166 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14167 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14169 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14170 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14171 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14172 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14173 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14174 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14175 | { } |
| 14176 | }; |
| 14177 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14178 | /* toggle speaker-output according to the hp-jack state */ |
| 14179 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14180 | { |
| 14181 | unsigned int present; |
| 14182 | unsigned char bits; |
| 14183 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14184 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14185 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14186 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14187 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14188 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14189 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14190 | |
| 14191 | snd_hda_codec_write(codec, 0x20, 0, |
| 14192 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14193 | snd_hda_codec_write(codec, 0x20, 0, |
| 14194 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14195 | |
| 14196 | snd_hda_codec_write(codec, 0x20, 0, |
| 14197 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14198 | snd_hda_codec_write(codec, 0x20, 0, |
| 14199 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14200 | } |
| 14201 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14202 | /* toggle speaker-output according to the hp-jacks state */ |
| 14203 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14204 | { |
| 14205 | unsigned int present; |
| 14206 | unsigned char bits; |
| 14207 | |
| 14208 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14209 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14210 | |
| 14211 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14212 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14213 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14214 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14215 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14216 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14217 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14218 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14219 | |
| 14220 | snd_hda_codec_write(codec, 0x20, 0, |
| 14221 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14222 | snd_hda_codec_write(codec, 0x20, 0, |
| 14223 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14224 | |
| 14225 | snd_hda_codec_write(codec, 0x20, 0, |
| 14226 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14227 | snd_hda_codec_write(codec, 0x20, 0, |
| 14228 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14229 | } |
| 14230 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14231 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14232 | { |
| 14233 | unsigned int present_laptop; |
| 14234 | unsigned int present_dock; |
| 14235 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14236 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14237 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14238 | |
| 14239 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14240 | if (present_dock) |
| 14241 | snd_hda_codec_write(codec, 0x23, 0, |
| 14242 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14243 | if (present_laptop) |
| 14244 | snd_hda_codec_write(codec, 0x23, 0, |
| 14245 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14246 | if (!present_dock && !present_laptop) |
| 14247 | snd_hda_codec_write(codec, 0x23, 0, |
| 14248 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14249 | } |
| 14250 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14251 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14252 | unsigned int res) |
| 14253 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14254 | switch (res >> 26) { |
| 14255 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14256 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14257 | break; |
| 14258 | case ALC880_MIC_EVENT: |
| 14259 | alc_mic_automute(codec); |
| 14260 | break; |
| 14261 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14262 | } |
| 14263 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14264 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14265 | unsigned int res) |
| 14266 | { |
| 14267 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14268 | alc269_lifebook_speaker_automute(codec); |
| 14269 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14270 | alc269_lifebook_mic_autoswitch(codec); |
| 14271 | } |
| 14272 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14273 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14274 | { |
| 14275 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14276 | spec->autocfg.hp_pins[0] = 0x15; |
| 14277 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14278 | spec->ext_mic.pin = 0x18; |
| 14279 | spec->ext_mic.mux_idx = 0; |
| 14280 | spec->int_mic.pin = 0x19; |
| 14281 | spec->int_mic.mux_idx = 1; |
| 14282 | spec->auto_mic = 1; |
| 14283 | } |
| 14284 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14285 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14286 | { |
| 14287 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14288 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14289 | } |
| 14290 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14291 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14292 | { |
| 14293 | alc269_lifebook_speaker_automute(codec); |
| 14294 | alc269_lifebook_mic_autoswitch(codec); |
| 14295 | } |
| 14296 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14297 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14299 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14300 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14301 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14302 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14303 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14304 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14305 | {} |
| 14306 | }; |
| 14307 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14308 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14309 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14310 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14311 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14312 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14313 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14314 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14315 | {} |
| 14316 | }; |
| 14317 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14318 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14319 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14320 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14321 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14322 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14323 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14324 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14325 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14326 | {} |
| 14327 | }; |
| 14328 | |
| 14329 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14330 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14331 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14332 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14333 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14334 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14335 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14336 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14337 | {} |
| 14338 | }; |
| 14339 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14340 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14341 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14342 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14343 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14344 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14345 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14346 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14347 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14348 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14349 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14350 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14351 | { } |
| 14352 | }; |
| 14353 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14354 | /* toggle speaker-output according to the hp-jack state */ |
| 14355 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14356 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14357 | struct alc_spec *spec = codec->spec; |
| 14358 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14359 | unsigned int present; |
| 14360 | unsigned char bits; |
| 14361 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14362 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14363 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14364 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14365 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14366 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14367 | HDA_AMP_MUTE, bits); |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14368 | alc_report_jack(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14369 | } |
| 14370 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14371 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14372 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14373 | unsigned int res) |
| 14374 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14375 | switch (res >> 26) { |
| 14376 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14377 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14378 | break; |
| 14379 | case ALC880_MIC_EVENT: |
| 14380 | alc_mic_automute(codec); |
| 14381 | break; |
| 14382 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14383 | } |
| 14384 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14385 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14386 | { |
| 14387 | struct alc_spec *spec = codec->spec; |
| 14388 | spec->autocfg.hp_pins[0] = 0x15; |
| 14389 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14390 | spec->ext_mic.pin = 0x18; |
| 14391 | spec->ext_mic.mux_idx = 0; |
| 14392 | spec->int_mic.pin = 0x19; |
| 14393 | spec->int_mic.mux_idx = 1; |
| 14394 | spec->auto_mic = 1; |
| 14395 | } |
| 14396 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14397 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14398 | { |
| 14399 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14400 | spec->autocfg.hp_pins[0] = 0x15; |
| 14401 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14402 | spec->ext_mic.pin = 0x18; |
| 14403 | spec->ext_mic.mux_idx = 0; |
| 14404 | spec->int_mic.pin = 0x12; |
| 14405 | spec->int_mic.mux_idx = 5; |
| 14406 | spec->auto_mic = 1; |
| 14407 | } |
| 14408 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14409 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14410 | { |
| 14411 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14412 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14413 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14414 | spec->ext_mic.pin = 0x18; |
| 14415 | spec->ext_mic.mux_idx = 0; |
| 14416 | spec->int_mic.pin = 0x19; |
| 14417 | spec->int_mic.mux_idx = 1; |
| 14418 | spec->auto_mic = 1; |
| 14419 | } |
| 14420 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14421 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14422 | { |
| 14423 | struct alc_spec *spec = codec->spec; |
| 14424 | spec->autocfg.hp_pins[0] = 0x21; |
| 14425 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14426 | spec->ext_mic.pin = 0x18; |
| 14427 | spec->ext_mic.mux_idx = 0; |
| 14428 | spec->int_mic.pin = 0x12; |
| 14429 | spec->int_mic.mux_idx = 6; |
| 14430 | spec->auto_mic = 1; |
| 14431 | } |
| 14432 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14433 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14434 | { |
| 14435 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14436 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14437 | } |
| 14438 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14439 | /* |
| 14440 | * generic initialization of ADC, input mixers and output mixers |
| 14441 | */ |
| 14442 | static struct hda_verb alc269_init_verbs[] = { |
| 14443 | /* |
| 14444 | * Unmute ADC0 and set the default input to mic-in |
| 14445 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14447 | |
| 14448 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14449 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14450 | */ |
| 14451 | /* set vol=0 to output mixers */ |
| 14452 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14453 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14454 | |
| 14455 | /* set up input amps for analog loopback */ |
| 14456 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14462 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14463 | |
| 14464 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14466 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14467 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14468 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14469 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14470 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14471 | |
| 14472 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14473 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14474 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14475 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14476 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14477 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14478 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14479 | |
| 14480 | /* set EAPD */ |
| 14481 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14482 | { } |
| 14483 | }; |
| 14484 | |
| 14485 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14486 | /* |
| 14487 | * Unmute ADC0 and set the default input to mic-in |
| 14488 | */ |
| 14489 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14490 | |
| 14491 | /* |
| 14492 | * Set up output mixers (0x02 - 0x03) |
| 14493 | */ |
| 14494 | /* set vol=0 to output mixers */ |
| 14495 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14496 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14497 | |
| 14498 | /* set up input amps for analog loopback */ |
| 14499 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14500 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14501 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14502 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14503 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14504 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14505 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14506 | |
| 14507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14508 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14509 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14510 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14511 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14512 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14513 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14514 | |
| 14515 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14516 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14517 | |
| 14518 | /* FIXME: use Mux-type input source selection */ |
| 14519 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14520 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14521 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14522 | |
| 14523 | /* set EAPD */ |
| 14524 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14525 | { } |
| 14526 | }; |
| 14527 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14528 | #define alc269_auto_create_multi_out_ctls \ |
| 14529 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14530 | #define alc269_auto_create_input_ctls \ |
| 14531 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14532 | |
| 14533 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14534 | #define alc269_loopbacks alc880_loopbacks |
| 14535 | #endif |
| 14536 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14537 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14538 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14539 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14540 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14541 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14542 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14543 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14544 | .substreams = 1, |
| 14545 | .channels_min = 2, |
| 14546 | .channels_max = 8, |
| 14547 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14548 | /* NID is set in alc_build_pcms */ |
| 14549 | .ops = { |
| 14550 | .open = alc880_playback_pcm_open, |
| 14551 | .prepare = alc880_playback_pcm_prepare, |
| 14552 | .cleanup = alc880_playback_pcm_cleanup |
| 14553 | }, |
| 14554 | }; |
| 14555 | |
| 14556 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14557 | .substreams = 1, |
| 14558 | .channels_min = 2, |
| 14559 | .channels_max = 2, |
| 14560 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14561 | /* NID is set in alc_build_pcms */ |
| 14562 | }; |
| 14563 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14564 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14565 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14566 | { |
| 14567 | switch (codec->subsystem_id) { |
| 14568 | case 0x103c1586: |
| 14569 | return 1; |
| 14570 | } |
| 14571 | return 0; |
| 14572 | } |
| 14573 | |
| 14574 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14575 | { |
| 14576 | /* update mute-LED according to the speaker mute state */ |
| 14577 | if (nid == 0x01 || nid == 0x14) { |
| 14578 | int pinval; |
| 14579 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14580 | HDA_AMP_MUTE) |
| 14581 | pinval = 0x24; |
| 14582 | else |
| 14583 | pinval = 0x20; |
| 14584 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14585 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14586 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14587 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14588 | } |
| 14589 | return alc_check_power_status(codec, nid); |
| 14590 | } |
| 14591 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14592 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14593 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14594 | { |
| 14595 | struct alc_spec *spec = codec->spec; |
| 14596 | |
| 14597 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14598 | return 0; |
| 14599 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14600 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14601 | if (spec->ext_mic.pin <= 0x12) { |
| 14602 | spec->private_adc_nids[0] = 0x08; |
| 14603 | spec->private_adc_nids[1] = 0x11; |
| 14604 | spec->private_capsrc_nids[0] = 0x23; |
| 14605 | spec->private_capsrc_nids[1] = 0x22; |
| 14606 | } else { |
| 14607 | spec->private_adc_nids[0] = 0x11; |
| 14608 | spec->private_adc_nids[1] = 0x08; |
| 14609 | spec->private_capsrc_nids[0] = 0x22; |
| 14610 | spec->private_capsrc_nids[1] = 0x23; |
| 14611 | } |
| 14612 | spec->adc_nids = spec->private_adc_nids; |
| 14613 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14614 | spec->num_adc_nids = 2; |
| 14615 | spec->dual_adc_switch = 1; |
| 14616 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14617 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14618 | return 1; |
| 14619 | } |
| 14620 | return 0; |
| 14621 | } |
| 14622 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14623 | /* different alc269-variants */ |
| 14624 | enum { |
| 14625 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame^] | 14626 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14627 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame^] | 14628 | ALC269_TYPE_ALC269VB, |
| 14629 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14630 | ALC269_TYPE_ALC271X, |
| 14631 | }; |
| 14632 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14633 | /* |
| 14634 | * BIOS auto configuration |
| 14635 | */ |
| 14636 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14637 | { |
| 14638 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14639 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14640 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14641 | |
| 14642 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14643 | alc269_ignore); |
| 14644 | if (err < 0) |
| 14645 | return err; |
| 14646 | |
| 14647 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14648 | if (err < 0) |
| 14649 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14650 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14651 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14652 | else |
| 14653 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14654 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14655 | if (err < 0) |
| 14656 | return err; |
| 14657 | |
| 14658 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14659 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14660 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14661 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14662 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14663 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14664 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14665 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14666 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14667 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14668 | } else { |
| 14669 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14670 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14671 | } |
| 14672 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14673 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14674 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14675 | |
| 14676 | if (!alc275_setup_dual_adc(codec)) |
| 14677 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14678 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14679 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14680 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14681 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14682 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14683 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14684 | |
| 14685 | err = alc_auto_add_mic_boost(codec); |
| 14686 | if (err < 0) |
| 14687 | return err; |
| 14688 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14689 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14690 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14691 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14692 | return 1; |
| 14693 | } |
| 14694 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14695 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14696 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14697 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14698 | |
| 14699 | |
| 14700 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14701 | static void alc269_auto_init(struct hda_codec *codec) |
| 14702 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14703 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14704 | alc269_auto_init_multi_out(codec); |
| 14705 | alc269_auto_init_hp_out(codec); |
| 14706 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14707 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14708 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14709 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14710 | } |
| 14711 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14712 | #ifdef SND_HDA_NEEDS_RESUME |
| 14713 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14714 | { |
| 14715 | int val = alc_read_coef_idx(codec, 0x04); |
| 14716 | if (power_up) |
| 14717 | val |= 1 << 11; |
| 14718 | else |
| 14719 | val &= ~(1 << 11); |
| 14720 | alc_write_coef_idx(codec, 0x04, val); |
| 14721 | } |
| 14722 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14723 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14724 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14725 | { |
| 14726 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14727 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14728 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14729 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14730 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14731 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14732 | msleep(150); |
| 14733 | } |
| 14734 | |
| 14735 | alc_shutup(codec); |
| 14736 | if (spec && spec->power_hook) |
| 14737 | spec->power_hook(codec); |
| 14738 | return 0; |
| 14739 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14740 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14741 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14742 | static int alc269_resume(struct hda_codec *codec) |
| 14743 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14744 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14745 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14746 | msleep(150); |
| 14747 | } |
| 14748 | |
| 14749 | codec->patch_ops.init(codec); |
| 14750 | |
| 14751 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14752 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14753 | msleep(200); |
| 14754 | } |
| 14755 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14756 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14757 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14758 | |
| 14759 | snd_hda_codec_resume_amp(codec); |
| 14760 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14761 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14762 | return 0; |
| 14763 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14764 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14765 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14766 | enum { |
| 14767 | ALC269_FIXUP_SONY_VAIO, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14768 | ALC269_FIXUP_DELL_M101Z, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14769 | }; |
| 14770 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14771 | static const struct alc_fixup alc269_fixups[] = { |
| 14772 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14773 | .verbs = (const struct hda_verb[]) { |
| 14774 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14775 | {} |
| 14776 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14777 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14778 | [ALC269_FIXUP_DELL_M101Z] = { |
| 14779 | .verbs = (const struct hda_verb[]) { |
| 14780 | /* Enables internal speaker */ |
| 14781 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14782 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14783 | {} |
| 14784 | } |
| 14785 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14786 | }; |
| 14787 | |
| 14788 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | abdd8f5 | 2010-09-21 17:38:14 +0200 | [diff] [blame] | 14789 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14790 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14791 | {} |
| 14792 | }; |
| 14793 | |
| 14794 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14795 | /* |
| 14796 | * configuration and preset |
| 14797 | */ |
| 14798 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14799 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14800 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14801 | [ALC269_AMIC] = "laptop-amic", |
| 14802 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14803 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14804 | [ALC269_LIFEBOOK] = "lifebook", |
| 14805 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14806 | }; |
| 14807 | |
| 14808 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14809 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14810 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14811 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14812 | ALC269_AMIC), |
| 14813 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14814 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14815 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14816 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14817 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14818 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14819 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14820 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14821 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14822 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14823 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14824 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14825 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14826 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14827 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14828 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14829 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14830 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14831 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14832 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14833 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14834 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14835 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14836 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14837 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14838 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14839 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14840 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14841 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14842 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14843 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14844 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14845 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14846 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14847 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14848 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14849 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14850 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14851 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14852 | ALC269_DMIC), |
| 14853 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14854 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14855 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14856 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14857 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14858 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14859 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14860 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14861 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14862 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14863 | {} |
| 14864 | }; |
| 14865 | |
| 14866 | static struct alc_config_preset alc269_presets[] = { |
| 14867 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14868 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14869 | .init_verbs = { alc269_init_verbs }, |
| 14870 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14871 | .dac_nids = alc269_dac_nids, |
| 14872 | .hp_nid = 0x03, |
| 14873 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14874 | .channel_mode = alc269_modes, |
| 14875 | .input_mux = &alc269_capture_source, |
| 14876 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14877 | [ALC269_QUANTA_FL1] = { |
| 14878 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14879 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14880 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14881 | .dac_nids = alc269_dac_nids, |
| 14882 | .hp_nid = 0x03, |
| 14883 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14884 | .channel_mode = alc269_modes, |
| 14885 | .input_mux = &alc269_capture_source, |
| 14886 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14887 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14888 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14889 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14890 | [ALC269_AMIC] = { |
| 14891 | .mixers = { alc269_laptop_mixer }, |
| 14892 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14893 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14894 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14895 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14896 | .dac_nids = alc269_dac_nids, |
| 14897 | .hp_nid = 0x03, |
| 14898 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14899 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14900 | .unsol_event = alc269_laptop_unsol_event, |
| 14901 | .setup = alc269_laptop_amic_setup, |
| 14902 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14903 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14904 | [ALC269_DMIC] = { |
| 14905 | .mixers = { alc269_laptop_mixer }, |
| 14906 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14907 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14908 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14909 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14910 | .dac_nids = alc269_dac_nids, |
| 14911 | .hp_nid = 0x03, |
| 14912 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14913 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14914 | .unsol_event = alc269_laptop_unsol_event, |
| 14915 | .setup = alc269_laptop_dmic_setup, |
| 14916 | .init_hook = alc269_laptop_inithook, |
| 14917 | }, |
| 14918 | [ALC269VB_AMIC] = { |
| 14919 | .mixers = { alc269vb_laptop_mixer }, |
| 14920 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14921 | .init_verbs = { alc269vb_init_verbs, |
| 14922 | alc269vb_laptop_amic_init_verbs }, |
| 14923 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14924 | .dac_nids = alc269_dac_nids, |
| 14925 | .hp_nid = 0x03, |
| 14926 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14927 | .channel_mode = alc269_modes, |
| 14928 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14929 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14930 | .init_hook = alc269_laptop_inithook, |
| 14931 | }, |
| 14932 | [ALC269VB_DMIC] = { |
| 14933 | .mixers = { alc269vb_laptop_mixer }, |
| 14934 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14935 | .init_verbs = { alc269vb_init_verbs, |
| 14936 | alc269vb_laptop_dmic_init_verbs }, |
| 14937 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14938 | .dac_nids = alc269_dac_nids, |
| 14939 | .hp_nid = 0x03, |
| 14940 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14941 | .channel_mode = alc269_modes, |
| 14942 | .unsol_event = alc269_laptop_unsol_event, |
| 14943 | .setup = alc269vb_laptop_dmic_setup, |
| 14944 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14945 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14946 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14947 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14948 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14949 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14950 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14951 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14952 | .dac_nids = alc269_dac_nids, |
| 14953 | .hp_nid = 0x03, |
| 14954 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14955 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14956 | .unsol_event = alc269_laptop_unsol_event, |
| 14957 | .setup = alc269_laptop_dmic_setup, |
| 14958 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14959 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14960 | [ALC269_LIFEBOOK] = { |
| 14961 | .mixers = { alc269_lifebook_mixer }, |
| 14962 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14963 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14964 | .dac_nids = alc269_dac_nids, |
| 14965 | .hp_nid = 0x03, |
| 14966 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14967 | .channel_mode = alc269_modes, |
| 14968 | .input_mux = &alc269_capture_source, |
| 14969 | .unsol_event = alc269_lifebook_unsol_event, |
| 14970 | .init_hook = alc269_lifebook_init_hook, |
| 14971 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14972 | [ALC271_ACER] = { |
| 14973 | .mixers = { alc269_asus_mixer }, |
| 14974 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14975 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14976 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14977 | .dac_nids = alc269_dac_nids, |
| 14978 | .adc_nids = alc262_dmic_adc_nids, |
| 14979 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14980 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14981 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14982 | .channel_mode = alc269_modes, |
| 14983 | .input_mux = &alc269_capture_source, |
| 14984 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14985 | .unsol_event = alc_sku_unsol_event, |
| 14986 | .setup = alc269vb_laptop_dmic_setup, |
| 14987 | .init_hook = alc_inithook, |
| 14988 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14989 | }; |
| 14990 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14991 | static int alc269_fill_coef(struct hda_codec *codec) |
| 14992 | { |
| 14993 | int val; |
| 14994 | |
| 14995 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 14996 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14997 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 14998 | } |
| 14999 | |
| 15000 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15001 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15002 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15003 | } |
| 15004 | |
| 15005 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15006 | val = alc_read_coef_idx(codec, 0x04); |
| 15007 | /* Power up output pin */ |
| 15008 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15009 | } |
| 15010 | |
| 15011 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15012 | val = alc_read_coef_idx(codec, 0xd); |
| 15013 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15014 | /* Capless ramp up clock control */ |
| 15015 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15016 | } |
| 15017 | val = alc_read_coef_idx(codec, 0x17); |
| 15018 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15019 | /* Class D power on reset */ |
| 15020 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15021 | } |
| 15022 | } |
| 15023 | return 0; |
| 15024 | } |
| 15025 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15026 | static int patch_alc269(struct hda_codec *codec) |
| 15027 | { |
| 15028 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame^] | 15029 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15030 | int err; |
| 15031 | |
| 15032 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15033 | if (spec == NULL) |
| 15034 | return -ENOMEM; |
| 15035 | |
| 15036 | codec->spec = spec; |
| 15037 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15038 | alc_auto_parse_customize_define(codec); |
| 15039 | |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame^] | 15040 | coef = alc_read_coef_idx(codec, 0); |
| 15041 | if ((coef & 0x00f0) == 0x0010) { |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15042 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15043 | spec->cdefine.platform_type == 1) { |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15044 | alc_codec_rename(codec, "ALC271X"); |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15045 | spec->codec_variant = ALC269_TYPE_ALC271X; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame^] | 15046 | } else if ((coef & 0xf000) == 0x1000) { |
| 15047 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15048 | } else if ((coef & 0xf000) == 0x2000) { |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15049 | alc_codec_rename(codec, "ALC259"); |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15050 | spec->codec_variant = ALC269_TYPE_ALC259; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame^] | 15051 | } else if ((coef & 0xf000) == 0x3000) { |
| 15052 | alc_codec_rename(codec, "ALC258"); |
| 15053 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15054 | } else { |
| 15055 | alc_codec_rename(codec, "ALC269VB"); |
| 15056 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15057 | } |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15058 | } else |
| 15059 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 15060 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15061 | alc269_fill_coef(codec); |
| 15062 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15063 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15064 | alc269_models, |
| 15065 | alc269_cfg_tbl); |
| 15066 | |
| 15067 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15068 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15069 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15070 | board_config = ALC269_AUTO; |
| 15071 | } |
| 15072 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15073 | if (board_config == ALC269_AUTO) |
| 15074 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 15075 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15076 | if (board_config == ALC269_AUTO) { |
| 15077 | /* automatic parse from the BIOS config */ |
| 15078 | err = alc269_parse_auto_config(codec); |
| 15079 | if (err < 0) { |
| 15080 | alc_free(codec); |
| 15081 | return err; |
| 15082 | } else if (!err) { |
| 15083 | printk(KERN_INFO |
| 15084 | "hda_codec: Cannot set up configuration " |
| 15085 | "from BIOS. Using base mode...\n"); |
| 15086 | board_config = ALC269_BASIC; |
| 15087 | } |
| 15088 | } |
| 15089 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15090 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15091 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15092 | if (err < 0) { |
| 15093 | alc_free(codec); |
| 15094 | return err; |
| 15095 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15096 | } |
| 15097 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15098 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15099 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15100 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15101 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15102 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15103 | * fix the sample rate of analog I/O to 44.1kHz |
| 15104 | */ |
| 15105 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15106 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15107 | } else if (spec->dual_adc_switch) { |
| 15108 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15109 | /* switch ADC dynamically */ |
| 15110 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15111 | } else { |
| 15112 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15113 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15114 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15115 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15116 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15117 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15118 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15119 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15120 | spec->adc_nids = alc269_adc_nids; |
| 15121 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15122 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15123 | } else { |
| 15124 | spec->adc_nids = alc269vb_adc_nids; |
| 15125 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15126 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15127 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15128 | } |
| 15129 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15130 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15131 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15132 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15133 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15134 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15135 | if (board_config == ALC269_AUTO) |
| 15136 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 15137 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15138 | spec->vmaster_nid = 0x02; |
| 15139 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15140 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15141 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15142 | codec->patch_ops.suspend = alc269_suspend; |
| 15143 | #endif |
| 15144 | #ifdef SND_HDA_NEEDS_RESUME |
| 15145 | codec->patch_ops.resume = alc269_resume; |
| 15146 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15147 | if (board_config == ALC269_AUTO) |
| 15148 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15149 | |
| 15150 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15151 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15152 | if (!spec->loopback.amplist) |
| 15153 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15154 | if (alc269_mic2_for_mute_led(codec)) |
| 15155 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15156 | #endif |
| 15157 | |
| 15158 | return 0; |
| 15159 | } |
| 15160 | |
| 15161 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15162 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15163 | */ |
| 15164 | |
| 15165 | /* |
| 15166 | * set the path ways for 2 channel output |
| 15167 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15168 | */ |
| 15169 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15170 | /* set pin widget 1Ah (line in) for input */ |
| 15171 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15172 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15173 | * the vref |
| 15174 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15175 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15176 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15177 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15178 | #if 0 |
| 15179 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15180 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15181 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15182 | { } /* end */ |
| 15183 | }; |
| 15184 | /* |
| 15185 | * 6ch mode |
| 15186 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15187 | */ |
| 15188 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15189 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15190 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15191 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15192 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15193 | |
| 15194 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15195 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15196 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15197 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15198 | #if 0 |
| 15199 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15200 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15201 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15202 | { } /* end */ |
| 15203 | }; |
| 15204 | |
| 15205 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15206 | { 2, alc861_threestack_ch2_init }, |
| 15207 | { 6, alc861_threestack_ch6_init }, |
| 15208 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15209 | /* Set mic1 as input and unmute the mixer */ |
| 15210 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15211 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15212 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15213 | { } /* end */ |
| 15214 | }; |
| 15215 | /* Set mic1 as output and mute mixer */ |
| 15216 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15217 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15218 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15219 | { } /* end */ |
| 15220 | }; |
| 15221 | |
| 15222 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15223 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15224 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15225 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15226 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15227 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15228 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15229 | /* set pin widget 1Ah (line in) for input */ |
| 15230 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15231 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15232 | * the vref |
| 15233 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15234 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15235 | |
| 15236 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15237 | #if 0 |
| 15238 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15239 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15240 | #endif |
| 15241 | { } /* end */ |
| 15242 | }; |
| 15243 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15244 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15245 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15246 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15247 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15248 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15249 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15250 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15251 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15252 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15253 | |
| 15254 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15255 | #if 0 |
| 15256 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15257 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15258 | #endif |
| 15259 | { } /* end */ |
| 15260 | }; |
| 15261 | |
| 15262 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15263 | { 2, alc861_asus_ch2_init }, |
| 15264 | { 6, alc861_asus_ch6_init }, |
| 15265 | }; |
| 15266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15267 | /* patch-ALC861 */ |
| 15268 | |
| 15269 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15270 | /* output mixer control */ |
| 15271 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15272 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15273 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15274 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15275 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15276 | |
| 15277 | /*Input mixer control */ |
| 15278 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15279 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15280 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15281 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15282 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15283 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15284 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15285 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15286 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15287 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15288 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15289 | { } /* end */ |
| 15290 | }; |
| 15291 | |
| 15292 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15293 | /* output mixer control */ |
| 15294 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15295 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15296 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15297 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15298 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15299 | |
| 15300 | /* Input mixer control */ |
| 15301 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15302 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15303 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15304 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15305 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15306 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15307 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15309 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15310 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15311 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15312 | { |
| 15313 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15314 | .name = "Channel Mode", |
| 15315 | .info = alc_ch_mode_info, |
| 15316 | .get = alc_ch_mode_get, |
| 15317 | .put = alc_ch_mode_put, |
| 15318 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15319 | }, |
| 15320 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15321 | }; |
| 15322 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15323 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15324 | /* output mixer control */ |
| 15325 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15326 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15327 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15328 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15329 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15330 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15331 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15332 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15333 | /* output mixer control */ |
| 15334 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15335 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15336 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15337 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15338 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15339 | |
| 15340 | /* Input mixer control */ |
| 15341 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15342 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15343 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15344 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15345 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15346 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15347 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15348 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15349 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15351 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15352 | { |
| 15353 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15354 | .name = "Channel Mode", |
| 15355 | .info = alc_ch_mode_info, |
| 15356 | .get = alc_ch_mode_get, |
| 15357 | .put = alc_ch_mode_put, |
| 15358 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15359 | }, |
| 15360 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15361 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15362 | |
| 15363 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15364 | /* output mixer control */ |
| 15365 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15366 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15367 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15368 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15369 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15370 | |
| 15371 | /* Input mixer control */ |
| 15372 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15373 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15374 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15375 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15376 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15377 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15380 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15381 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15382 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15383 | { |
| 15384 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15385 | .name = "Channel Mode", |
| 15386 | .info = alc_ch_mode_info, |
| 15387 | .get = alc_ch_mode_get, |
| 15388 | .put = alc_ch_mode_put, |
| 15389 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15390 | }, |
| 15391 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15392 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15393 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15394 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15395 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15396 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15397 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15398 | { } |
| 15399 | }; |
| 15400 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15401 | /* |
| 15402 | * generic initialization of ADC, input mixers and output mixers |
| 15403 | */ |
| 15404 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15405 | /* |
| 15406 | * Unmute ADC0 and set the default input to mic-in |
| 15407 | */ |
| 15408 | /* port-A for surround (rear panel) */ |
| 15409 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15410 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15411 | /* port-B for mic-in (rear panel) with vref */ |
| 15412 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15413 | /* port-C for line-in (rear panel) */ |
| 15414 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15415 | /* port-D for Front */ |
| 15416 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15417 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15418 | /* port-E for HP out (front panel) */ |
| 15419 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15420 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15421 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15422 | /* port-F for mic-in (front panel) with vref */ |
| 15423 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15424 | /* port-G for CLFE (rear panel) */ |
| 15425 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15426 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15427 | /* port-H for side (rear panel) */ |
| 15428 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15429 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15430 | /* CD-in */ |
| 15431 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15432 | /* route front mic to ADC1*/ |
| 15433 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15435 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15436 | /* Unmute DAC0~3 & spdif out*/ |
| 15437 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15438 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15439 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15440 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15441 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15442 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15443 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15444 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15445 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15446 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15447 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15448 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15449 | /* Unmute Stereo Mixer 15 */ |
| 15450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15451 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15452 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15453 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15454 | |
| 15455 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15456 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15457 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15458 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15459 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15460 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15461 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15462 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15463 | /* hp used DAC 3 (Front) */ |
| 15464 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15465 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15466 | |
| 15467 | { } |
| 15468 | }; |
| 15469 | |
| 15470 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15471 | /* |
| 15472 | * Unmute ADC0 and set the default input to mic-in |
| 15473 | */ |
| 15474 | /* port-A for surround (rear panel) */ |
| 15475 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15476 | /* port-B for mic-in (rear panel) with vref */ |
| 15477 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15478 | /* port-C for line-in (rear panel) */ |
| 15479 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15480 | /* port-D for Front */ |
| 15481 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15482 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15483 | /* port-E for HP out (front panel) */ |
| 15484 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15485 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15486 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15487 | /* port-F for mic-in (front panel) with vref */ |
| 15488 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15489 | /* port-G for CLFE (rear panel) */ |
| 15490 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15491 | /* port-H for side (rear panel) */ |
| 15492 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15493 | /* CD-in */ |
| 15494 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15495 | /* route front mic to ADC1*/ |
| 15496 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15497 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15498 | /* Unmute DAC0~3 & spdif out*/ |
| 15499 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15500 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15501 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15502 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15504 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15505 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15506 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15507 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15508 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15509 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15511 | /* Unmute Stereo Mixer 15 */ |
| 15512 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15513 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15514 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15515 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15516 | |
| 15517 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15518 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15519 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15520 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15521 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15522 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15523 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15524 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15525 | /* hp used DAC 3 (Front) */ |
| 15526 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15527 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15528 | { } |
| 15529 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15530 | |
| 15531 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15532 | /* |
| 15533 | * Unmute ADC0 and set the default input to mic-in |
| 15534 | */ |
| 15535 | /* port-A for surround (rear panel) */ |
| 15536 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15537 | /* port-B for mic-in (rear panel) with vref */ |
| 15538 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15539 | /* port-C for line-in (rear panel) */ |
| 15540 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15541 | /* port-D for Front */ |
| 15542 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15543 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15544 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15545 | /* this has to be set to VREF80 */ |
| 15546 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15547 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15548 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15549 | /* port-F for mic-in (front panel) with vref */ |
| 15550 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15551 | /* port-G for CLFE (rear panel) */ |
| 15552 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15553 | /* port-H for side (rear panel) */ |
| 15554 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15555 | /* CD-in */ |
| 15556 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15557 | /* route front mic to ADC1*/ |
| 15558 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15559 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15560 | /* Unmute DAC0~3 & spdif out*/ |
| 15561 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15562 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15563 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15564 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15566 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [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 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [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)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15577 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15578 | |
| 15579 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15580 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15581 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15582 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15583 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15584 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15585 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15586 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15587 | /* hp used DAC 3 (Front) */ |
| 15588 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15589 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15590 | { } |
| 15591 | }; |
| 15592 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15593 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15594 | /* |
| 15595 | * Unmute ADC0 and set the default input to mic-in |
| 15596 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15597 | /* port-A for surround (rear panel) |
| 15598 | * according to codec#0 this is the HP jack |
| 15599 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15600 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15601 | /* route front PCM to HP */ |
| 15602 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15603 | /* port-B for mic-in (rear panel) with vref */ |
| 15604 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15605 | /* port-C for line-in (rear panel) */ |
| 15606 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15607 | /* port-D for Front */ |
| 15608 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15609 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15610 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15611 | /* this has to be set to VREF80 */ |
| 15612 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15613 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15614 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15615 | /* port-F for mic-in (front panel) with vref */ |
| 15616 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15617 | /* port-G for CLFE (rear panel) */ |
| 15618 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15619 | /* port-H for side (rear panel) */ |
| 15620 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15621 | /* CD-in */ |
| 15622 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15623 | /* route front mic to ADC1*/ |
| 15624 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15625 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15626 | /* Unmute DAC0~3 & spdif out*/ |
| 15627 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15628 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15629 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15630 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15631 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15632 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15633 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15634 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15635 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15636 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15637 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15638 | /* Unmute Stereo Mixer 15 */ |
| 15639 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15641 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15642 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15643 | |
| 15644 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15645 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15646 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15647 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15648 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15649 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15650 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15651 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15652 | /* hp used DAC 3 (Front) */ |
| 15653 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15654 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15655 | { } |
| 15656 | }; |
| 15657 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15658 | /* additional init verbs for ASUS laptops */ |
| 15659 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15660 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15661 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15662 | { } |
| 15663 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15664 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15665 | /* |
| 15666 | * generic initialization of ADC, input mixers and output mixers |
| 15667 | */ |
| 15668 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15669 | /* |
| 15670 | * Unmute ADC0 and set the default input to mic-in |
| 15671 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15672 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15673 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15674 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15675 | /* Unmute DAC0~3 & spdif out*/ |
| 15676 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15677 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15678 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15679 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15680 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15681 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15682 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15683 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15684 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15685 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15686 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15687 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15688 | /* Unmute Stereo Mixer 15 */ |
| 15689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15692 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15693 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15694 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15695 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15696 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15697 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15698 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15699 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15700 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15701 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15702 | |
| 15703 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15704 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15705 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15706 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15707 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15708 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15709 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15710 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15711 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15712 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15713 | |
| 15714 | { } |
| 15715 | }; |
| 15716 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15717 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15718 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15719 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15720 | { } |
| 15721 | }; |
| 15722 | |
| 15723 | /* toggle speaker-output according to the hp-jack state */ |
| 15724 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15725 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15726 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15727 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15728 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15729 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15730 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15731 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15732 | } |
| 15733 | |
| 15734 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15735 | unsigned int res) |
| 15736 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15737 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15738 | alc861_toshiba_automute(codec); |
| 15739 | } |
| 15740 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15741 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15742 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15743 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15744 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15745 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15746 | |
| 15747 | |
| 15748 | #define ALC861_DIGOUT_NID 0x07 |
| 15749 | |
| 15750 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15751 | { 8, NULL } |
| 15752 | }; |
| 15753 | |
| 15754 | static hda_nid_t alc861_dac_nids[4] = { |
| 15755 | /* front, surround, clfe, side */ |
| 15756 | 0x03, 0x06, 0x05, 0x04 |
| 15757 | }; |
| 15758 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15759 | static hda_nid_t alc660_dac_nids[3] = { |
| 15760 | /* front, clfe, surround */ |
| 15761 | 0x03, 0x05, 0x06 |
| 15762 | }; |
| 15763 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15764 | static hda_nid_t alc861_adc_nids[1] = { |
| 15765 | /* ADC0-2 */ |
| 15766 | 0x08, |
| 15767 | }; |
| 15768 | |
| 15769 | static struct hda_input_mux alc861_capture_source = { |
| 15770 | .num_items = 5, |
| 15771 | .items = { |
| 15772 | { "Mic", 0x0 }, |
| 15773 | { "Front Mic", 0x3 }, |
| 15774 | { "Line", 0x1 }, |
| 15775 | { "CD", 0x4 }, |
| 15776 | { "Mixer", 0x5 }, |
| 15777 | }, |
| 15778 | }; |
| 15779 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15780 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15781 | { |
| 15782 | struct alc_spec *spec = codec->spec; |
| 15783 | hda_nid_t mix, srcs[5]; |
| 15784 | int i, j, num; |
| 15785 | |
| 15786 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15787 | return 0; |
| 15788 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15789 | if (num < 0) |
| 15790 | return 0; |
| 15791 | for (i = 0; i < num; i++) { |
| 15792 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15793 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15794 | if (type != AC_WID_AUD_OUT) |
| 15795 | continue; |
| 15796 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15797 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15798 | break; |
| 15799 | if (j >= spec->multiout.num_dacs) |
| 15800 | return srcs[i]; |
| 15801 | } |
| 15802 | return 0; |
| 15803 | } |
| 15804 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15805 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15806 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15807 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15808 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15809 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15810 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15811 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15812 | |
| 15813 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15814 | for (i = 0; i < cfg->line_outs; i++) { |
| 15815 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15816 | dac = alc861_look_for_dac(codec, nid); |
| 15817 | if (!dac) |
| 15818 | continue; |
| 15819 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15820 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15821 | return 0; |
| 15822 | } |
| 15823 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15824 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15825 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15826 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15827 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15828 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15829 | } |
| 15830 | |
| 15831 | /* add playback controls from the parsed DAC table */ |
| 15832 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15833 | const struct auto_pin_cfg *cfg) |
| 15834 | { |
| 15835 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15836 | static const char *chname[4] = { |
| 15837 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15838 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15839 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15840 | int i, err; |
| 15841 | |
| 15842 | if (cfg->line_outs == 1) { |
| 15843 | const char *pfx = NULL; |
| 15844 | if (!cfg->hp_outs) |
| 15845 | pfx = "Master"; |
| 15846 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15847 | pfx = "Speaker"; |
| 15848 | if (pfx) { |
| 15849 | nid = spec->multiout.dac_nids[0]; |
| 15850 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15851 | } |
| 15852 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15853 | |
| 15854 | for (i = 0; i < cfg->line_outs; i++) { |
| 15855 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15856 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15857 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15858 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15859 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15860 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15861 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15862 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15863 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15864 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15865 | return err; |
| 15866 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15867 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15868 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15869 | return err; |
| 15870 | } |
| 15871 | } |
| 15872 | return 0; |
| 15873 | } |
| 15874 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15875 | 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] | 15876 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15877 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15878 | int err; |
| 15879 | hda_nid_t nid; |
| 15880 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15881 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15882 | return 0; |
| 15883 | |
| 15884 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15885 | nid = alc861_look_for_dac(codec, pin); |
| 15886 | if (nid) { |
| 15887 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15888 | if (err < 0) |
| 15889 | return err; |
| 15890 | spec->multiout.hp_nid = nid; |
| 15891 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15892 | } |
| 15893 | return 0; |
| 15894 | } |
| 15895 | |
| 15896 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15897 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15898 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15899 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15900 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15901 | } |
| 15902 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15903 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15904 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15905 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15906 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15907 | hda_nid_t mix, srcs[5]; |
| 15908 | int i, num; |
| 15909 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15910 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15911 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15912 | 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] | 15913 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15914 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15915 | return; |
| 15916 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15917 | if (num < 0) |
| 15918 | return; |
| 15919 | for (i = 0; i < num; i++) { |
| 15920 | unsigned int mute; |
| 15921 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15922 | mute = AMP_IN_UNMUTE(i); |
| 15923 | else |
| 15924 | mute = AMP_IN_MUTE(i); |
| 15925 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15926 | mute); |
| 15927 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15928 | } |
| 15929 | |
| 15930 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15931 | { |
| 15932 | struct alc_spec *spec = codec->spec; |
| 15933 | int i; |
| 15934 | |
| 15935 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15936 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15937 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15938 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15939 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15940 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15941 | } |
| 15942 | } |
| 15943 | |
| 15944 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15945 | { |
| 15946 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15947 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15948 | if (spec->autocfg.hp_outs) |
| 15949 | alc861_auto_set_output_and_unmute(codec, |
| 15950 | spec->autocfg.hp_pins[0], |
| 15951 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15952 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15953 | if (spec->autocfg.speaker_outs) |
| 15954 | alc861_auto_set_output_and_unmute(codec, |
| 15955 | spec->autocfg.speaker_pins[0], |
| 15956 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15957 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15958 | } |
| 15959 | |
| 15960 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15961 | { |
| 15962 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15963 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15964 | int i; |
| 15965 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15966 | for (i = 0; i < cfg->num_inputs; i++) { |
| 15967 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15968 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 15969 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15970 | } |
| 15971 | } |
| 15972 | |
| 15973 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15974 | /* return 1 if successful, 0 if the proper config is not found, |
| 15975 | * or a negative error code |
| 15976 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15977 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15978 | { |
| 15979 | struct alc_spec *spec = codec->spec; |
| 15980 | int err; |
| 15981 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15982 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15983 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15984 | alc861_ignore); |
| 15985 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15986 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15987 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15988 | return 0; /* can't find valid BIOS pin config */ |
| 15989 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15990 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15991 | if (err < 0) |
| 15992 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15993 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15994 | if (err < 0) |
| 15995 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15996 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15997 | if (err < 0) |
| 15998 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15999 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16000 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16001 | return err; |
| 16002 | |
| 16003 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16004 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16005 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16006 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16007 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16008 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16009 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16010 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16011 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16012 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16013 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16014 | |
| 16015 | spec->adc_nids = alc861_adc_nids; |
| 16016 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16017 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16018 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16019 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16020 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16021 | return 1; |
| 16022 | } |
| 16023 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16024 | /* additional initialization for auto-configuration model */ |
| 16025 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16026 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16027 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16028 | alc861_auto_init_multi_out(codec); |
| 16029 | alc861_auto_init_hp_out(codec); |
| 16030 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16031 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16032 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16033 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16034 | } |
| 16035 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16036 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16037 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16038 | { 0x15, HDA_INPUT, 0 }, |
| 16039 | { 0x15, HDA_INPUT, 1 }, |
| 16040 | { 0x15, HDA_INPUT, 2 }, |
| 16041 | { 0x15, HDA_INPUT, 3 }, |
| 16042 | { } /* end */ |
| 16043 | }; |
| 16044 | #endif |
| 16045 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16046 | |
| 16047 | /* |
| 16048 | * configuration and preset |
| 16049 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16050 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 16051 | [ALC861_3ST] = "3stack", |
| 16052 | [ALC660_3ST] = "3stack-660", |
| 16053 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16054 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16055 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16056 | [ALC861_TOSHIBA] = "toshiba", |
| 16057 | [ALC861_ASUS] = "asus", |
| 16058 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16059 | [ALC861_AUTO] = "auto", |
| 16060 | }; |
| 16061 | |
| 16062 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16063 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16064 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16065 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16066 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16067 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16068 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16069 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16070 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16071 | * Any other models that need this preset? |
| 16072 | */ |
| 16073 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16074 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16075 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16076 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16077 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16078 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16079 | /* FIXME: the below seems conflict */ |
| 16080 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16081 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16082 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16083 | {} |
| 16084 | }; |
| 16085 | |
| 16086 | static struct alc_config_preset alc861_presets[] = { |
| 16087 | [ALC861_3ST] = { |
| 16088 | .mixers = { alc861_3ST_mixer }, |
| 16089 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16090 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16091 | .dac_nids = alc861_dac_nids, |
| 16092 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16093 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16094 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16095 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16096 | .adc_nids = alc861_adc_nids, |
| 16097 | .input_mux = &alc861_capture_source, |
| 16098 | }, |
| 16099 | [ALC861_3ST_DIG] = { |
| 16100 | .mixers = { alc861_base_mixer }, |
| 16101 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16102 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16103 | .dac_nids = alc861_dac_nids, |
| 16104 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16105 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16106 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16107 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16108 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16109 | .adc_nids = alc861_adc_nids, |
| 16110 | .input_mux = &alc861_capture_source, |
| 16111 | }, |
| 16112 | [ALC861_6ST_DIG] = { |
| 16113 | .mixers = { alc861_base_mixer }, |
| 16114 | .init_verbs = { alc861_base_init_verbs }, |
| 16115 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16116 | .dac_nids = alc861_dac_nids, |
| 16117 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16118 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16119 | .channel_mode = alc861_8ch_modes, |
| 16120 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16121 | .adc_nids = alc861_adc_nids, |
| 16122 | .input_mux = &alc861_capture_source, |
| 16123 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16124 | [ALC660_3ST] = { |
| 16125 | .mixers = { alc861_3ST_mixer }, |
| 16126 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16127 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16128 | .dac_nids = alc660_dac_nids, |
| 16129 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16130 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16131 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16132 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16133 | .adc_nids = alc861_adc_nids, |
| 16134 | .input_mux = &alc861_capture_source, |
| 16135 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16136 | [ALC861_UNIWILL_M31] = { |
| 16137 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16138 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16139 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16140 | .dac_nids = alc861_dac_nids, |
| 16141 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16142 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16143 | .channel_mode = alc861_uniwill_m31_modes, |
| 16144 | .need_dac_fix = 1, |
| 16145 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16146 | .adc_nids = alc861_adc_nids, |
| 16147 | .input_mux = &alc861_capture_source, |
| 16148 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16149 | [ALC861_TOSHIBA] = { |
| 16150 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16151 | .init_verbs = { alc861_base_init_verbs, |
| 16152 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16153 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16154 | .dac_nids = alc861_dac_nids, |
| 16155 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16156 | .channel_mode = alc883_3ST_2ch_modes, |
| 16157 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16158 | .adc_nids = alc861_adc_nids, |
| 16159 | .input_mux = &alc861_capture_source, |
| 16160 | .unsol_event = alc861_toshiba_unsol_event, |
| 16161 | .init_hook = alc861_toshiba_automute, |
| 16162 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16163 | [ALC861_ASUS] = { |
| 16164 | .mixers = { alc861_asus_mixer }, |
| 16165 | .init_verbs = { alc861_asus_init_verbs }, |
| 16166 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16167 | .dac_nids = alc861_dac_nids, |
| 16168 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16169 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16170 | .channel_mode = alc861_asus_modes, |
| 16171 | .need_dac_fix = 1, |
| 16172 | .hp_nid = 0x06, |
| 16173 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16174 | .adc_nids = alc861_adc_nids, |
| 16175 | .input_mux = &alc861_capture_source, |
| 16176 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16177 | [ALC861_ASUS_LAPTOP] = { |
| 16178 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16179 | .init_verbs = { alc861_asus_init_verbs, |
| 16180 | alc861_asus_laptop_init_verbs }, |
| 16181 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16182 | .dac_nids = alc861_dac_nids, |
| 16183 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16184 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16185 | .channel_mode = alc883_3ST_2ch_modes, |
| 16186 | .need_dac_fix = 1, |
| 16187 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16188 | .adc_nids = alc861_adc_nids, |
| 16189 | .input_mux = &alc861_capture_source, |
| 16190 | }, |
| 16191 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16192 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16193 | /* Pin config fixes */ |
| 16194 | enum { |
| 16195 | PINFIX_FSC_AMILO_PI1505, |
| 16196 | }; |
| 16197 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16198 | static const struct alc_fixup alc861_fixups[] = { |
| 16199 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16200 | .pins = (const struct alc_pincfg[]) { |
| 16201 | { 0x0b, 0x0221101f }, /* HP */ |
| 16202 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16203 | { } |
| 16204 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16205 | }, |
| 16206 | }; |
| 16207 | |
| 16208 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16209 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16210 | {} |
| 16211 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16212 | |
| 16213 | static int patch_alc861(struct hda_codec *codec) |
| 16214 | { |
| 16215 | struct alc_spec *spec; |
| 16216 | int board_config; |
| 16217 | int err; |
| 16218 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16219 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16220 | if (spec == NULL) |
| 16221 | return -ENOMEM; |
| 16222 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16223 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16224 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16225 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16226 | alc861_models, |
| 16227 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16228 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16229 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16230 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16231 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16232 | board_config = ALC861_AUTO; |
| 16233 | } |
| 16234 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16235 | if (board_config == ALC861_AUTO) |
| 16236 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16237 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16238 | if (board_config == ALC861_AUTO) { |
| 16239 | /* automatic parse from the BIOS config */ |
| 16240 | err = alc861_parse_auto_config(codec); |
| 16241 | if (err < 0) { |
| 16242 | alc_free(codec); |
| 16243 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16244 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16245 | printk(KERN_INFO |
| 16246 | "hda_codec: Cannot set up configuration " |
| 16247 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16248 | board_config = ALC861_3ST_DIG; |
| 16249 | } |
| 16250 | } |
| 16251 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16252 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16253 | if (err < 0) { |
| 16254 | alc_free(codec); |
| 16255 | return err; |
| 16256 | } |
| 16257 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16258 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16259 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16260 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16261 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16262 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16263 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16264 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16265 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16266 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16267 | if (!spec->cap_mixer) |
| 16268 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16269 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16270 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16271 | spec->vmaster_nid = 0x03; |
| 16272 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16273 | if (board_config == ALC861_AUTO) |
| 16274 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 16275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16276 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16277 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16278 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16279 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16280 | spec->power_hook = alc_power_eapd; |
| 16281 | #endif |
| 16282 | } |
| 16283 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16284 | if (!spec->loopback.amplist) |
| 16285 | spec->loopback.amplist = alc861_loopbacks; |
| 16286 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16287 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16288 | return 0; |
| 16289 | } |
| 16290 | |
| 16291 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16292 | * ALC861-VD support |
| 16293 | * |
| 16294 | * Based on ALC882 |
| 16295 | * |
| 16296 | * In addition, an independent DAC |
| 16297 | */ |
| 16298 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16299 | |
| 16300 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16301 | /* front, surr, clfe, side surr */ |
| 16302 | 0x02, 0x03, 0x04, 0x05 |
| 16303 | }; |
| 16304 | |
| 16305 | /* dac_nids for ALC660vd are in a different order - according to |
| 16306 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16307 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16308 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16309 | * - and it is the same as in 861vd. |
| 16310 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16311 | */ |
| 16312 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16313 | /* front, rear, clfe, rear_surr */ |
| 16314 | 0x02, 0x04, 0x03 |
| 16315 | }; |
| 16316 | |
| 16317 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16318 | /* ADC0 */ |
| 16319 | 0x09, |
| 16320 | }; |
| 16321 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16322 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16323 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16324 | /* input MUX */ |
| 16325 | /* FIXME: should be a matrix-type input source selection */ |
| 16326 | static struct hda_input_mux alc861vd_capture_source = { |
| 16327 | .num_items = 4, |
| 16328 | .items = { |
| 16329 | { "Mic", 0x0 }, |
| 16330 | { "Front Mic", 0x1 }, |
| 16331 | { "Line", 0x2 }, |
| 16332 | { "CD", 0x4 }, |
| 16333 | }, |
| 16334 | }; |
| 16335 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16336 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16337 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16338 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16339 | { "Ext Mic", 0x0 }, |
| 16340 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16341 | }, |
| 16342 | }; |
| 16343 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16344 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16345 | .num_items = 2, |
| 16346 | .items = { |
| 16347 | { "Front Mic", 0x0 }, |
| 16348 | { "ATAPI Mic", 0x1 }, |
| 16349 | }, |
| 16350 | }; |
| 16351 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16352 | /* |
| 16353 | * 2ch mode |
| 16354 | */ |
| 16355 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16356 | { 2, NULL } |
| 16357 | }; |
| 16358 | |
| 16359 | /* |
| 16360 | * 6ch mode |
| 16361 | */ |
| 16362 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16363 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16364 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16365 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16366 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16367 | { } /* end */ |
| 16368 | }; |
| 16369 | |
| 16370 | /* |
| 16371 | * 8ch mode |
| 16372 | */ |
| 16373 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16374 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16375 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16376 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16377 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16378 | { } /* end */ |
| 16379 | }; |
| 16380 | |
| 16381 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16382 | { 6, alc861vd_6stack_ch6_init }, |
| 16383 | { 8, alc861vd_6stack_ch8_init }, |
| 16384 | }; |
| 16385 | |
| 16386 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16387 | { |
| 16388 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16389 | .name = "Channel Mode", |
| 16390 | .info = alc_ch_mode_info, |
| 16391 | .get = alc_ch_mode_get, |
| 16392 | .put = alc_ch_mode_put, |
| 16393 | }, |
| 16394 | { } /* end */ |
| 16395 | }; |
| 16396 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16397 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16398 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16399 | */ |
| 16400 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16401 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16402 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16403 | |
| 16404 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16405 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16406 | |
| 16407 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16408 | HDA_OUTPUT), |
| 16409 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16410 | HDA_OUTPUT), |
| 16411 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16412 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16413 | |
| 16414 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16415 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16416 | |
| 16417 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16418 | |
| 16419 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16420 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16421 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16422 | |
| 16423 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16424 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16425 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16426 | |
| 16427 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16428 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16429 | |
| 16430 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16431 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16432 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16433 | { } /* end */ |
| 16434 | }; |
| 16435 | |
| 16436 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16437 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16438 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16439 | |
| 16440 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16441 | |
| 16442 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16444 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16445 | |
| 16446 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16447 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16448 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16449 | |
| 16450 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16451 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16452 | |
| 16453 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16454 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16455 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16456 | { } /* end */ |
| 16457 | }; |
| 16458 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16459 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16460 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16461 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16462 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16463 | |
| 16464 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16465 | |
| 16466 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16469 | |
| 16470 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16471 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16472 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16473 | |
| 16474 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16475 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16476 | |
| 16477 | { } /* end */ |
| 16478 | }; |
| 16479 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16480 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 16481 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16482 | */ |
| 16483 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16484 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16485 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16486 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16487 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16488 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16489 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16490 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16491 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16492 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16493 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16494 | { } /* end */ |
| 16495 | }; |
| 16496 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16497 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16498 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16499 | */ |
| 16500 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16501 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16502 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16503 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16504 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16505 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16506 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16507 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16508 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16509 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16510 | { } /* end */ |
| 16511 | }; |
| 16512 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16513 | /* |
| 16514 | * generic initialization of ADC, input mixers and output mixers |
| 16515 | */ |
| 16516 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16517 | /* |
| 16518 | * Unmute ADC0 and set the default input to mic-in |
| 16519 | */ |
| 16520 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16521 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16522 | |
| 16523 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16524 | * the analog-loopback mixer widget |
| 16525 | */ |
| 16526 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16527 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16528 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16529 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16530 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16531 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16532 | |
| 16533 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16534 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16535 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16536 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16537 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16538 | |
| 16539 | /* |
| 16540 | * Set up output mixers (0x02 - 0x05) |
| 16541 | */ |
| 16542 | /* set vol=0 to output mixers */ |
| 16543 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16544 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16545 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16546 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16547 | |
| 16548 | /* set up input amps for analog loopback */ |
| 16549 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16550 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16551 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16552 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16553 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16554 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16555 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16556 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16557 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16558 | |
| 16559 | { } |
| 16560 | }; |
| 16561 | |
| 16562 | /* |
| 16563 | * 3-stack pin configuration: |
| 16564 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16565 | */ |
| 16566 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16567 | /* |
| 16568 | * Set pin mode and muting |
| 16569 | */ |
| 16570 | /* set front pin widgets 0x14 for output */ |
| 16571 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16572 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16573 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16574 | |
| 16575 | /* Mic (rear) pin: input vref at 80% */ |
| 16576 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16577 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16578 | /* Front Mic pin: input vref at 80% */ |
| 16579 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16580 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16581 | /* Line In pin: input */ |
| 16582 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16583 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16584 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16585 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16586 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16587 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16588 | /* CD pin widget for input */ |
| 16589 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16590 | |
| 16591 | { } |
| 16592 | }; |
| 16593 | |
| 16594 | /* |
| 16595 | * 6-stack pin configuration: |
| 16596 | */ |
| 16597 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16598 | /* |
| 16599 | * Set pin mode and muting |
| 16600 | */ |
| 16601 | /* set front pin widgets 0x14 for output */ |
| 16602 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16603 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16604 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16605 | |
| 16606 | /* Rear Pin: output 1 (0x0d) */ |
| 16607 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16608 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16609 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16610 | /* CLFE Pin: output 2 (0x0e) */ |
| 16611 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16612 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16613 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16614 | /* Side Pin: output 3 (0x0f) */ |
| 16615 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16616 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16617 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16618 | |
| 16619 | /* Mic (rear) pin: input vref at 80% */ |
| 16620 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16621 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16622 | /* Front Mic pin: input vref at 80% */ |
| 16623 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16624 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16625 | /* Line In pin: input */ |
| 16626 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16627 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16628 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16629 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16630 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16631 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16632 | /* CD pin widget for input */ |
| 16633 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16634 | |
| 16635 | { } |
| 16636 | }; |
| 16637 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16638 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16639 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16640 | { } |
| 16641 | }; |
| 16642 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16643 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16644 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16645 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16646 | { } |
| 16647 | }; |
| 16648 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16649 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16650 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16651 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16653 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16654 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16655 | {} |
| 16656 | }; |
| 16657 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16658 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16659 | { |
| 16660 | unsigned int present; |
| 16661 | unsigned char bits; |
| 16662 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16663 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16664 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16665 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16666 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16667 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16668 | } |
| 16669 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16670 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16671 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16672 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16673 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16674 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16675 | } |
| 16676 | |
| 16677 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16678 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16679 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16680 | alc861vd_lenovo_mic_automute(codec); |
| 16681 | } |
| 16682 | |
| 16683 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16684 | unsigned int res) |
| 16685 | { |
| 16686 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16687 | case ALC880_MIC_EVENT: |
| 16688 | alc861vd_lenovo_mic_automute(codec); |
| 16689 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16690 | default: |
| 16691 | alc_automute_amp_unsol_event(codec, res); |
| 16692 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16693 | } |
| 16694 | } |
| 16695 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16696 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16697 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16698 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16699 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16700 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16701 | |
| 16702 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16704 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16705 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16706 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16707 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16708 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16709 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16710 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16711 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16712 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16713 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16714 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16715 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16716 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16717 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16718 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16719 | |
| 16720 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16721 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16722 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16723 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16724 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16725 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16726 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16727 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16728 | |
| 16729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16732 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16733 | |
| 16734 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16735 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16736 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16737 | |
| 16738 | { } /* end */ |
| 16739 | }; |
| 16740 | |
| 16741 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16742 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16743 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16744 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16745 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16746 | spec->autocfg.hp_pins[0] = 0x15; |
| 16747 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16748 | } |
| 16749 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16750 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16751 | #define alc861vd_loopbacks alc880_loopbacks |
| 16752 | #endif |
| 16753 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16754 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16755 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16756 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16757 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16758 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16759 | |
| 16760 | /* |
| 16761 | * configuration and preset |
| 16762 | */ |
| 16763 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16764 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16765 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16766 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16767 | [ALC861VD_3ST] = "3stack", |
| 16768 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16769 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16770 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16771 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16772 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16773 | [ALC861VD_AUTO] = "auto", |
| 16774 | }; |
| 16775 | |
| 16776 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16777 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16778 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16779 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16780 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16781 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16782 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16783 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16784 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16785 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16786 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16787 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16788 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16789 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16790 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16791 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16792 | {} |
| 16793 | }; |
| 16794 | |
| 16795 | static struct alc_config_preset alc861vd_presets[] = { |
| 16796 | [ALC660VD_3ST] = { |
| 16797 | .mixers = { alc861vd_3st_mixer }, |
| 16798 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16799 | alc861vd_3stack_init_verbs }, |
| 16800 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16801 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16802 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16803 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16804 | .input_mux = &alc861vd_capture_source, |
| 16805 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16806 | [ALC660VD_3ST_DIG] = { |
| 16807 | .mixers = { alc861vd_3st_mixer }, |
| 16808 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16809 | alc861vd_3stack_init_verbs }, |
| 16810 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16811 | .dac_nids = alc660vd_dac_nids, |
| 16812 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16813 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16814 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16815 | .input_mux = &alc861vd_capture_source, |
| 16816 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16817 | [ALC861VD_3ST] = { |
| 16818 | .mixers = { alc861vd_3st_mixer }, |
| 16819 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16820 | alc861vd_3stack_init_verbs }, |
| 16821 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16822 | .dac_nids = alc861vd_dac_nids, |
| 16823 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16824 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16825 | .input_mux = &alc861vd_capture_source, |
| 16826 | }, |
| 16827 | [ALC861VD_3ST_DIG] = { |
| 16828 | .mixers = { alc861vd_3st_mixer }, |
| 16829 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16830 | alc861vd_3stack_init_verbs }, |
| 16831 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16832 | .dac_nids = alc861vd_dac_nids, |
| 16833 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16834 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16835 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16836 | .input_mux = &alc861vd_capture_source, |
| 16837 | }, |
| 16838 | [ALC861VD_6ST_DIG] = { |
| 16839 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16840 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16841 | alc861vd_6stack_init_verbs }, |
| 16842 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16843 | .dac_nids = alc861vd_dac_nids, |
| 16844 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16845 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16846 | .channel_mode = alc861vd_6stack_modes, |
| 16847 | .input_mux = &alc861vd_capture_source, |
| 16848 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16849 | [ALC861VD_LENOVO] = { |
| 16850 | .mixers = { alc861vd_lenovo_mixer }, |
| 16851 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16852 | alc861vd_3stack_init_verbs, |
| 16853 | alc861vd_eapd_verbs, |
| 16854 | alc861vd_lenovo_unsol_verbs }, |
| 16855 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16856 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16857 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16858 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16859 | .input_mux = &alc861vd_capture_source, |
| 16860 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16861 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16862 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16863 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16864 | [ALC861VD_DALLAS] = { |
| 16865 | .mixers = { alc861vd_dallas_mixer }, |
| 16866 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16867 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16868 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16869 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16870 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16871 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16872 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16873 | .setup = alc861vd_dallas_setup, |
| 16874 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16875 | }, |
| 16876 | [ALC861VD_HP] = { |
| 16877 | .mixers = { alc861vd_hp_mixer }, |
| 16878 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16879 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16880 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16881 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16882 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16883 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16884 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16885 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16886 | .setup = alc861vd_dallas_setup, |
| 16887 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16888 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16889 | [ALC660VD_ASUS_V1S] = { |
| 16890 | .mixers = { alc861vd_lenovo_mixer }, |
| 16891 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16892 | alc861vd_3stack_init_verbs, |
| 16893 | alc861vd_eapd_verbs, |
| 16894 | alc861vd_lenovo_unsol_verbs }, |
| 16895 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16896 | .dac_nids = alc660vd_dac_nids, |
| 16897 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16898 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16899 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16900 | .input_mux = &alc861vd_capture_source, |
| 16901 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16902 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16903 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16904 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16905 | }; |
| 16906 | |
| 16907 | /* |
| 16908 | * BIOS auto configuration |
| 16909 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16910 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16911 | const struct auto_pin_cfg *cfg) |
| 16912 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16913 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16914 | } |
| 16915 | |
| 16916 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16917 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16918 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16919 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16920 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16921 | } |
| 16922 | |
| 16923 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16924 | { |
| 16925 | struct alc_spec *spec = codec->spec; |
| 16926 | int i; |
| 16927 | |
| 16928 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16929 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16930 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16931 | if (nid) |
| 16932 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16933 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16934 | } |
| 16935 | } |
| 16936 | |
| 16937 | |
| 16938 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16939 | { |
| 16940 | struct alc_spec *spec = codec->spec; |
| 16941 | hda_nid_t pin; |
| 16942 | |
| 16943 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16944 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16945 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16946 | pin = spec->autocfg.speaker_pins[0]; |
| 16947 | if (pin) |
| 16948 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16949 | } |
| 16950 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16951 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16952 | |
| 16953 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16954 | { |
| 16955 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16956 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16957 | int i; |
| 16958 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16959 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16960 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16961 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16962 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16963 | if (nid != ALC861VD_PIN_CD_NID && |
| 16964 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16965 | snd_hda_codec_write(codec, nid, 0, |
| 16966 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16967 | AMP_OUT_MUTE); |
| 16968 | } |
| 16969 | } |
| 16970 | } |
| 16971 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16972 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16973 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16974 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16975 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16976 | |
| 16977 | /* add playback controls from the parsed DAC table */ |
| 16978 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16979 | * different NIDs for mute/unmute switch and volume control */ |
| 16980 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16981 | const struct auto_pin_cfg *cfg) |
| 16982 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16983 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16984 | hda_nid_t nid_v, nid_s; |
| 16985 | int i, err; |
| 16986 | |
| 16987 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16988 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16989 | continue; |
| 16990 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16991 | alc880_dac_to_idx( |
| 16992 | spec->multiout.dac_nids[i])); |
| 16993 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16994 | alc880_dac_to_idx( |
| 16995 | spec->multiout.dac_nids[i])); |
| 16996 | |
| 16997 | if (i == 2) { |
| 16998 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16999 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17000 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17001 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17002 | HDA_OUTPUT)); |
| 17003 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17004 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17005 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17006 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17007 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17008 | HDA_OUTPUT)); |
| 17009 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17010 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17011 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17012 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17013 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17014 | HDA_INPUT)); |
| 17015 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17016 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17017 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17018 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17019 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17020 | HDA_INPUT)); |
| 17021 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17022 | return err; |
| 17023 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 17024 | const char *pfx; |
| 17025 | if (cfg->line_outs == 1 && |
| 17026 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 17027 | if (!cfg->hp_pins) |
| 17028 | pfx = "Speaker"; |
| 17029 | else |
| 17030 | pfx = "PCM"; |
| 17031 | } else |
| 17032 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17033 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17034 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17035 | HDA_OUTPUT)); |
| 17036 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17037 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 17038 | if (cfg->line_outs == 1 && |
| 17039 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17040 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17041 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17042 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17043 | HDA_INPUT)); |
| 17044 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17045 | return err; |
| 17046 | } |
| 17047 | } |
| 17048 | return 0; |
| 17049 | } |
| 17050 | |
| 17051 | /* add playback controls for speaker and HP outputs */ |
| 17052 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17053 | * different NIDs for mute/unmute switch and volume control */ |
| 17054 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17055 | hda_nid_t pin, const char *pfx) |
| 17056 | { |
| 17057 | hda_nid_t nid_v, nid_s; |
| 17058 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17059 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17060 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17061 | return 0; |
| 17062 | |
| 17063 | if (alc880_is_fixed_pin(pin)) { |
| 17064 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17065 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17066 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17067 | spec->multiout.hp_nid = nid_v; |
| 17068 | else |
| 17069 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17070 | /* control HP volume/switch on the output mixer amp */ |
| 17071 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17072 | alc880_fixed_pin_idx(pin)); |
| 17073 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17074 | alc880_fixed_pin_idx(pin)); |
| 17075 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17076 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17077 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17078 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17079 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17080 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17081 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17082 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17083 | return err; |
| 17084 | } else if (alc880_is_multi_pin(pin)) { |
| 17085 | /* set manual connection */ |
| 17086 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17087 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17088 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17089 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17090 | return err; |
| 17091 | } |
| 17092 | return 0; |
| 17093 | } |
| 17094 | |
| 17095 | /* parse the BIOS configuration and set up the alc_spec |
| 17096 | * return 1 if successful, 0 if the proper config is not found, |
| 17097 | * or a negative error code |
| 17098 | * Based on ALC880 version - had to change it to override |
| 17099 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17100 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17101 | { |
| 17102 | struct alc_spec *spec = codec->spec; |
| 17103 | int err; |
| 17104 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17105 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17106 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17107 | alc861vd_ignore); |
| 17108 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17109 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17110 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17111 | return 0; /* can't find valid BIOS pin config */ |
| 17112 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17113 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17114 | if (err < 0) |
| 17115 | return err; |
| 17116 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17117 | if (err < 0) |
| 17118 | return err; |
| 17119 | err = alc861vd_auto_create_extra_out(spec, |
| 17120 | spec->autocfg.speaker_pins[0], |
| 17121 | "Speaker"); |
| 17122 | if (err < 0) |
| 17123 | return err; |
| 17124 | err = alc861vd_auto_create_extra_out(spec, |
| 17125 | spec->autocfg.hp_pins[0], |
| 17126 | "Headphone"); |
| 17127 | if (err < 0) |
| 17128 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17129 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17130 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17131 | return err; |
| 17132 | |
| 17133 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17134 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17135 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17136 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17137 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17138 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17139 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17140 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17141 | |
| 17142 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17143 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17144 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17145 | err = alc_auto_add_mic_boost(codec); |
| 17146 | if (err < 0) |
| 17147 | return err; |
| 17148 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17149 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17150 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17151 | return 1; |
| 17152 | } |
| 17153 | |
| 17154 | /* additional initialization for auto-configuration model */ |
| 17155 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17156 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17157 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17158 | alc861vd_auto_init_multi_out(codec); |
| 17159 | alc861vd_auto_init_hp_out(codec); |
| 17160 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17161 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17162 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17163 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17164 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17165 | } |
| 17166 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17167 | enum { |
| 17168 | ALC660VD_FIX_ASUS_GPIO1 |
| 17169 | }; |
| 17170 | |
| 17171 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17172 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17173 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17174 | .verbs = (const struct hda_verb[]) { |
| 17175 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17176 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17177 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17178 | { } |
| 17179 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17180 | }, |
| 17181 | }; |
| 17182 | |
| 17183 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17184 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17185 | {} |
| 17186 | }; |
| 17187 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17188 | static int patch_alc861vd(struct hda_codec *codec) |
| 17189 | { |
| 17190 | struct alc_spec *spec; |
| 17191 | int err, board_config; |
| 17192 | |
| 17193 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17194 | if (spec == NULL) |
| 17195 | return -ENOMEM; |
| 17196 | |
| 17197 | codec->spec = spec; |
| 17198 | |
| 17199 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17200 | alc861vd_models, |
| 17201 | alc861vd_cfg_tbl); |
| 17202 | |
| 17203 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17204 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17205 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17206 | board_config = ALC861VD_AUTO; |
| 17207 | } |
| 17208 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17209 | if (board_config == ALC861VD_AUTO) |
| 17210 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17211 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17212 | if (board_config == ALC861VD_AUTO) { |
| 17213 | /* automatic parse from the BIOS config */ |
| 17214 | err = alc861vd_parse_auto_config(codec); |
| 17215 | if (err < 0) { |
| 17216 | alc_free(codec); |
| 17217 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17218 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17219 | printk(KERN_INFO |
| 17220 | "hda_codec: Cannot set up configuration " |
| 17221 | "from BIOS. Using base mode...\n"); |
| 17222 | board_config = ALC861VD_3ST; |
| 17223 | } |
| 17224 | } |
| 17225 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17226 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17227 | if (err < 0) { |
| 17228 | alc_free(codec); |
| 17229 | return err; |
| 17230 | } |
| 17231 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17232 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17233 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17234 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17235 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17236 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17237 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17238 | } |
| 17239 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17240 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17241 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17242 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17243 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17244 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17245 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17246 | if (!spec->adc_nids) { |
| 17247 | spec->adc_nids = alc861vd_adc_nids; |
| 17248 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17249 | } |
| 17250 | if (!spec->capsrc_nids) |
| 17251 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17252 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17253 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17254 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17255 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17256 | spec->vmaster_nid = 0x02; |
| 17257 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17258 | if (board_config == ALC861VD_AUTO) |
| 17259 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 17260 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17261 | codec->patch_ops = alc_patch_ops; |
| 17262 | |
| 17263 | if (board_config == ALC861VD_AUTO) |
| 17264 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17265 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17266 | if (!spec->loopback.amplist) |
| 17267 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17268 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17269 | |
| 17270 | return 0; |
| 17271 | } |
| 17272 | |
| 17273 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17274 | * ALC662 support |
| 17275 | * |
| 17276 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17277 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17278 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17279 | * 6-channel independent captures. |
| 17280 | * |
| 17281 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17282 | * driver yet). |
| 17283 | */ |
| 17284 | #define ALC662_DIGOUT_NID 0x06 |
| 17285 | #define ALC662_DIGIN_NID 0x0a |
| 17286 | |
| 17287 | static hda_nid_t alc662_dac_nids[4] = { |
| 17288 | /* front, rear, clfe, rear_surr */ |
| 17289 | 0x02, 0x03, 0x04 |
| 17290 | }; |
| 17291 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17292 | static hda_nid_t alc272_dac_nids[2] = { |
| 17293 | 0x02, 0x03 |
| 17294 | }; |
| 17295 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17296 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17297 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17298 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17299 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17300 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17301 | static hda_nid_t alc272_adc_nids[1] = { |
| 17302 | /* ADC1-2 */ |
| 17303 | 0x08, |
| 17304 | }; |
| 17305 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17306 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17307 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17308 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17309 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17310 | /* input MUX */ |
| 17311 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17312 | static struct hda_input_mux alc662_capture_source = { |
| 17313 | .num_items = 4, |
| 17314 | .items = { |
| 17315 | { "Mic", 0x0 }, |
| 17316 | { "Front Mic", 0x1 }, |
| 17317 | { "Line", 0x2 }, |
| 17318 | { "CD", 0x4 }, |
| 17319 | }, |
| 17320 | }; |
| 17321 | |
| 17322 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17323 | .num_items = 2, |
| 17324 | .items = { |
| 17325 | { "Mic", 0x1 }, |
| 17326 | { "Line", 0x2 }, |
| 17327 | }, |
| 17328 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17329 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17330 | static struct hda_input_mux alc663_capture_source = { |
| 17331 | .num_items = 3, |
| 17332 | .items = { |
| 17333 | { "Mic", 0x0 }, |
| 17334 | { "Front Mic", 0x1 }, |
| 17335 | { "Line", 0x2 }, |
| 17336 | }, |
| 17337 | }; |
| 17338 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17339 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17340 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17341 | .num_items = 16, |
| 17342 | .items = { |
| 17343 | { "Autoselect Mic", 0x0 }, |
| 17344 | { "Internal Mic", 0x1 }, |
| 17345 | { "In-0x02", 0x2 }, |
| 17346 | { "In-0x03", 0x3 }, |
| 17347 | { "In-0x04", 0x4 }, |
| 17348 | { "In-0x05", 0x5 }, |
| 17349 | { "In-0x06", 0x6 }, |
| 17350 | { "In-0x07", 0x7 }, |
| 17351 | { "In-0x08", 0x8 }, |
| 17352 | { "In-0x09", 0x9 }, |
| 17353 | { "In-0x0a", 0x0a }, |
| 17354 | { "In-0x0b", 0x0b }, |
| 17355 | { "In-0x0c", 0x0c }, |
| 17356 | { "In-0x0d", 0x0d }, |
| 17357 | { "In-0x0e", 0x0e }, |
| 17358 | { "In-0x0f", 0x0f }, |
| 17359 | }, |
| 17360 | }; |
| 17361 | #endif |
| 17362 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17363 | /* |
| 17364 | * 2ch mode |
| 17365 | */ |
| 17366 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17367 | { 2, NULL } |
| 17368 | }; |
| 17369 | |
| 17370 | /* |
| 17371 | * 2ch mode |
| 17372 | */ |
| 17373 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17374 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17375 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17376 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17377 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17378 | { } /* end */ |
| 17379 | }; |
| 17380 | |
| 17381 | /* |
| 17382 | * 6ch mode |
| 17383 | */ |
| 17384 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17385 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17386 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17387 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17388 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17389 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17390 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17391 | { } /* end */ |
| 17392 | }; |
| 17393 | |
| 17394 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17395 | { 2, alc662_3ST_ch2_init }, |
| 17396 | { 6, alc662_3ST_ch6_init }, |
| 17397 | }; |
| 17398 | |
| 17399 | /* |
| 17400 | * 2ch mode |
| 17401 | */ |
| 17402 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17403 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17404 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17405 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17406 | { } /* end */ |
| 17407 | }; |
| 17408 | |
| 17409 | /* |
| 17410 | * 6ch mode |
| 17411 | */ |
| 17412 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17413 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17414 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17415 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17416 | { } /* end */ |
| 17417 | }; |
| 17418 | |
| 17419 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17420 | { 2, alc662_sixstack_ch6_init }, |
| 17421 | { 6, alc662_sixstack_ch8_init }, |
| 17422 | }; |
| 17423 | |
| 17424 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17425 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17426 | */ |
| 17427 | |
| 17428 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17429 | /* output mixer control */ |
| 17430 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17431 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17432 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17433 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17434 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17435 | 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] | 17436 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17437 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17438 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17439 | |
| 17440 | /*Input mixer control */ |
| 17441 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17442 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17443 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17444 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17445 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17446 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17447 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17448 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17449 | { } /* end */ |
| 17450 | }; |
| 17451 | |
| 17452 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17453 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17454 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17455 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17456 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17457 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17458 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17459 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17460 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17462 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17463 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17464 | { } /* end */ |
| 17465 | }; |
| 17466 | |
| 17467 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17468 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17469 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17470 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17471 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17472 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17473 | 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] | 17474 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17475 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17476 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17477 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17478 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17479 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17480 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17481 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17482 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17483 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17484 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17485 | { } /* end */ |
| 17486 | }; |
| 17487 | |
| 17488 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17489 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17490 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17491 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17492 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17493 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17494 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17495 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17496 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17497 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17498 | { } /* end */ |
| 17499 | }; |
| 17500 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17501 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17502 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17503 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17504 | |
| 17505 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17506 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17507 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17508 | |
| 17509 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17510 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17511 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17512 | { } /* end */ |
| 17513 | }; |
| 17514 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17515 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17516 | ALC262_HIPPO_MASTER_SWITCH, |
| 17517 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17518 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17519 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17520 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17521 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17522 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17523 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17526 | { } /* end */ |
| 17527 | }; |
| 17528 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17529 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17530 | .ops = &snd_hda_bind_vol, |
| 17531 | .values = { |
| 17532 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17533 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17534 | 0 |
| 17535 | }, |
| 17536 | }; |
| 17537 | |
| 17538 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17539 | .ops = &snd_hda_bind_sw, |
| 17540 | .values = { |
| 17541 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17542 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17543 | 0 |
| 17544 | }, |
| 17545 | }; |
| 17546 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17547 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17548 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17549 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17552 | { } /* end */ |
| 17553 | }; |
| 17554 | |
| 17555 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17556 | .ops = &snd_hda_bind_sw, |
| 17557 | .values = { |
| 17558 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17559 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17560 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17561 | 0 |
| 17562 | }, |
| 17563 | }; |
| 17564 | |
| 17565 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17566 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17567 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17568 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17569 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17570 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17571 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17572 | |
| 17573 | { } /* end */ |
| 17574 | }; |
| 17575 | |
| 17576 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17577 | .ops = &snd_hda_bind_sw, |
| 17578 | .values = { |
| 17579 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17580 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17581 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17582 | 0 |
| 17583 | }, |
| 17584 | }; |
| 17585 | |
| 17586 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17587 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17588 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17589 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17590 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17591 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17592 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17593 | { } /* end */ |
| 17594 | }; |
| 17595 | |
| 17596 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17597 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17598 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17599 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17600 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17601 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17602 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17603 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17604 | { } /* end */ |
| 17605 | }; |
| 17606 | |
| 17607 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17608 | .ops = &snd_hda_bind_vol, |
| 17609 | .values = { |
| 17610 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17611 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17612 | 0 |
| 17613 | }, |
| 17614 | }; |
| 17615 | |
| 17616 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17617 | .ops = &snd_hda_bind_sw, |
| 17618 | .values = { |
| 17619 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17620 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17621 | 0 |
| 17622 | }, |
| 17623 | }; |
| 17624 | |
| 17625 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17626 | HDA_BIND_VOL("Master Playback Volume", |
| 17627 | &alc663_asus_two_bind_master_vol), |
| 17628 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17629 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17630 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17633 | { } /* end */ |
| 17634 | }; |
| 17635 | |
| 17636 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17637 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17638 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17639 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17640 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17643 | { } /* end */ |
| 17644 | }; |
| 17645 | |
| 17646 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17647 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17648 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17649 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17650 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17651 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17652 | |
| 17653 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17654 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17655 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17656 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17657 | { } /* end */ |
| 17658 | }; |
| 17659 | |
| 17660 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17661 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17662 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17663 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17664 | |
| 17665 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17666 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17667 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17668 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17669 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17670 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17671 | { } /* end */ |
| 17672 | }; |
| 17673 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17674 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17675 | .ops = &snd_hda_bind_sw, |
| 17676 | .values = { |
| 17677 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17678 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17679 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17680 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17681 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17682 | 0 |
| 17683 | }, |
| 17684 | }; |
| 17685 | |
| 17686 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17687 | .ops = &snd_hda_bind_sw, |
| 17688 | .values = { |
| 17689 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17690 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17691 | 0 |
| 17692 | }, |
| 17693 | }; |
| 17694 | |
| 17695 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17696 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17697 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17698 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17699 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17700 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17701 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17702 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17703 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17704 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17705 | { } /* end */ |
| 17706 | }; |
| 17707 | |
| 17708 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17709 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17710 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17711 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17712 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17713 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17714 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17715 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17716 | { } /* end */ |
| 17717 | }; |
| 17718 | |
| 17719 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17720 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17721 | { |
| 17722 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17723 | .name = "Channel Mode", |
| 17724 | .info = alc_ch_mode_info, |
| 17725 | .get = alc_ch_mode_get, |
| 17726 | .put = alc_ch_mode_put, |
| 17727 | }, |
| 17728 | { } /* end */ |
| 17729 | }; |
| 17730 | |
| 17731 | static struct hda_verb alc662_init_verbs[] = { |
| 17732 | /* ADC: mute amp left and right */ |
| 17733 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17734 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17735 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17737 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17738 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17739 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17740 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17741 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17742 | |
| 17743 | /* Front Pin: output 0 (0x0c) */ |
| 17744 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17746 | |
| 17747 | /* Rear Pin: output 1 (0x0d) */ |
| 17748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17750 | |
| 17751 | /* CLFE Pin: output 2 (0x0e) */ |
| 17752 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17753 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17754 | |
| 17755 | /* Mic (rear) pin: input vref at 80% */ |
| 17756 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17757 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17758 | /* Front Mic pin: input vref at 80% */ |
| 17759 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17760 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17761 | /* Line In pin: input */ |
| 17762 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17763 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17764 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17765 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17766 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17767 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17768 | /* CD pin widget for input */ |
| 17769 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17770 | |
| 17771 | /* FIXME: use matrix-type input source selection */ |
| 17772 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17773 | /* Input mixer */ |
| 17774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17775 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17776 | |
| 17777 | /* always trun on EAPD */ |
| 17778 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17779 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17780 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17781 | { } |
| 17782 | }; |
| 17783 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17784 | static struct hda_verb alc663_init_verbs[] = { |
| 17785 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17786 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17787 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17788 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17789 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17790 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17791 | { } |
| 17792 | }; |
| 17793 | |
| 17794 | static struct hda_verb alc272_init_verbs[] = { |
| 17795 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17796 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17797 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17798 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17799 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17800 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17801 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17802 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17803 | { } |
| 17804 | }; |
| 17805 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17806 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17807 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17808 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17809 | {} |
| 17810 | }; |
| 17811 | |
| 17812 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17813 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17814 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17815 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17816 | }; |
| 17817 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17818 | /* Set Unsolicited Event*/ |
| 17819 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17820 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17821 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17822 | {} |
| 17823 | }; |
| 17824 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17825 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17826 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17827 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17828 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17829 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17830 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17831 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17832 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17833 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17834 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17835 | {} |
| 17836 | }; |
| 17837 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17838 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17839 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17840 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17841 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17842 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17843 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17844 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17845 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17846 | {} |
| 17847 | }; |
| 17848 | |
| 17849 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17850 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17851 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17852 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17853 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17854 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17855 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17856 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17857 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17858 | {} |
| 17859 | }; |
| 17860 | |
| 17861 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17862 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17863 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17864 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17865 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17866 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17867 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17868 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17869 | {} |
| 17870 | }; |
| 17871 | |
| 17872 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17873 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17874 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17875 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17876 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17877 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17878 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17879 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17880 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17881 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17882 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17883 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17884 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17885 | {} |
| 17886 | }; |
| 17887 | |
| 17888 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17889 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17890 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17891 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17892 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17893 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17894 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17895 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17896 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17897 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17898 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17899 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17900 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17901 | {} |
| 17902 | }; |
| 17903 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17904 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17905 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17906 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17907 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17908 | |
| 17909 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17910 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17911 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17912 | |
| 17913 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17914 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17915 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17916 | {} |
| 17917 | }; |
| 17918 | |
| 17919 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17920 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17921 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17922 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17923 | |
| 17924 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17925 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17926 | {} |
| 17927 | }; |
| 17928 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17929 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17930 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17931 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17932 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17933 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17934 | {} |
| 17935 | }; |
| 17936 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17937 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17938 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17939 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17940 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17941 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17942 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17943 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17944 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17945 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17946 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17947 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17948 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17949 | {} |
| 17950 | }; |
| 17951 | |
| 17952 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17953 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17954 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17955 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17956 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17957 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17958 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17959 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17960 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17961 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17962 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17963 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17964 | {} |
| 17965 | }; |
| 17966 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17967 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17969 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17970 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17971 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17972 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17973 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17974 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17975 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17976 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17977 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17979 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17980 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17981 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17982 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17983 | {} |
| 17984 | }; |
| 17985 | |
| 17986 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17987 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17988 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17989 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17990 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17991 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17992 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17993 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17994 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17995 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17996 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17997 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18000 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18001 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18002 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18003 | {} |
| 18004 | }; |
| 18005 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18006 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18007 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18008 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18009 | { } /* end */ |
| 18010 | }; |
| 18011 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18012 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18013 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18014 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18015 | { } /* end */ |
| 18016 | }; |
| 18017 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18018 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18019 | { |
| 18020 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18021 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18022 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18023 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18024 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18025 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18026 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18027 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18028 | } |
| 18029 | |
| 18030 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18031 | { |
| 18032 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18033 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18034 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18035 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18036 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18037 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18038 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18039 | HDA_AMP_MUTE, bits); |
| 18040 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18041 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18042 | } |
| 18043 | |
| 18044 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18045 | unsigned int res) |
| 18046 | { |
| 18047 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18048 | alc662_lenovo_101e_all_automute(codec); |
| 18049 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18050 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18051 | } |
| 18052 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18053 | /* unsolicited event for HP jack sensing */ |
| 18054 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18055 | unsigned int res) |
| 18056 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18057 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18058 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18059 | else |
| 18060 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18061 | } |
| 18062 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18063 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18064 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18065 | struct alc_spec *spec = codec->spec; |
| 18066 | |
| 18067 | alc262_hippo1_setup(codec); |
| 18068 | spec->ext_mic.pin = 0x18; |
| 18069 | spec->ext_mic.mux_idx = 0; |
| 18070 | spec->int_mic.pin = 0x19; |
| 18071 | spec->int_mic.mux_idx = 1; |
| 18072 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18073 | } |
| 18074 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18075 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18076 | { |
| 18077 | alc262_hippo_automute(codec); |
| 18078 | alc_mic_automute(codec); |
| 18079 | } |
| 18080 | |
| 18081 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18082 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18083 | struct alc_spec *spec = codec->spec; |
| 18084 | |
| 18085 | spec->autocfg.hp_pins[0] = 0x14; |
| 18086 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18087 | } |
| 18088 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18089 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18090 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18091 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18092 | { |
| 18093 | unsigned int present; |
| 18094 | unsigned char bits; |
| 18095 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18096 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18097 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18098 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18099 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18100 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18101 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18102 | } |
| 18103 | |
| 18104 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18105 | { |
| 18106 | unsigned int present; |
| 18107 | unsigned char bits; |
| 18108 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18109 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18110 | bits = present ? HDA_AMP_MUTE : 0; |
| 18111 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18112 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18113 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18114 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18115 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18116 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18117 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18118 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18119 | } |
| 18120 | |
| 18121 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18122 | { |
| 18123 | unsigned int present; |
| 18124 | unsigned char bits; |
| 18125 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18126 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18127 | bits = present ? HDA_AMP_MUTE : 0; |
| 18128 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18129 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18130 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18131 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18132 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18133 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18134 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18135 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18136 | } |
| 18137 | |
| 18138 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18139 | { |
| 18140 | unsigned int present; |
| 18141 | unsigned char bits; |
| 18142 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18143 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18144 | bits = present ? 0 : PIN_OUT; |
| 18145 | snd_hda_codec_write(codec, 0x14, 0, |
| 18146 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18147 | } |
| 18148 | |
| 18149 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18150 | { |
| 18151 | unsigned int present1, present2; |
| 18152 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18153 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18154 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18155 | |
| 18156 | if (present1 || present2) { |
| 18157 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18158 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18159 | } else { |
| 18160 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18161 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18162 | } |
| 18163 | } |
| 18164 | |
| 18165 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18166 | { |
| 18167 | unsigned int present1, present2; |
| 18168 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18169 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18170 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18171 | |
| 18172 | if (present1 || present2) { |
| 18173 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18174 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18175 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18176 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18177 | } else { |
| 18178 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18179 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18180 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18181 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18182 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18183 | } |
| 18184 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18185 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18186 | { |
| 18187 | unsigned int present1, present2; |
| 18188 | |
| 18189 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18190 | AC_VERB_GET_PIN_SENSE, 0) |
| 18191 | & AC_PINSENSE_PRESENCE; |
| 18192 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18193 | AC_VERB_GET_PIN_SENSE, 0) |
| 18194 | & AC_PINSENSE_PRESENCE; |
| 18195 | |
| 18196 | if (present1 || present2) { |
| 18197 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18198 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18199 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18200 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18201 | } else { |
| 18202 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18203 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18204 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18205 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18206 | } |
| 18207 | } |
| 18208 | |
| 18209 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18210 | { |
| 18211 | unsigned int present1, present2; |
| 18212 | |
| 18213 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18214 | AC_VERB_GET_PIN_SENSE, 0) |
| 18215 | & AC_PINSENSE_PRESENCE; |
| 18216 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18217 | AC_VERB_GET_PIN_SENSE, 0) |
| 18218 | & AC_PINSENSE_PRESENCE; |
| 18219 | |
| 18220 | if (present1 || present2) { |
| 18221 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18222 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18223 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18224 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18225 | } else { |
| 18226 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18227 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18228 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18229 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18230 | } |
| 18231 | } |
| 18232 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18233 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18234 | unsigned int res) |
| 18235 | { |
| 18236 | switch (res >> 26) { |
| 18237 | case ALC880_HP_EVENT: |
| 18238 | alc663_m51va_speaker_automute(codec); |
| 18239 | break; |
| 18240 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18241 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18242 | break; |
| 18243 | } |
| 18244 | } |
| 18245 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18246 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18247 | { |
| 18248 | struct alc_spec *spec = codec->spec; |
| 18249 | spec->ext_mic.pin = 0x18; |
| 18250 | spec->ext_mic.mux_idx = 0; |
| 18251 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18252 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18253 | spec->auto_mic = 1; |
| 18254 | } |
| 18255 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18256 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18257 | { |
| 18258 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18259 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18260 | } |
| 18261 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18262 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18263 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18264 | |
| 18265 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18266 | { |
| 18267 | struct alc_spec *spec = codec->spec; |
| 18268 | spec->ext_mic.pin = 0x18; |
| 18269 | spec->ext_mic.mux_idx = 0; |
| 18270 | spec->int_mic.pin = 0x19; |
| 18271 | spec->int_mic.mux_idx = 1; |
| 18272 | spec->auto_mic = 1; |
| 18273 | } |
| 18274 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18275 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18276 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18277 | /* ***************** Mode2 ******************************/ |
| 18278 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18279 | unsigned int res) |
| 18280 | { |
| 18281 | switch (res >> 26) { |
| 18282 | case ALC880_HP_EVENT: |
| 18283 | alc662_f5z_speaker_automute(codec); |
| 18284 | break; |
| 18285 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18286 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18287 | break; |
| 18288 | } |
| 18289 | } |
| 18290 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18291 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18292 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18293 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18294 | { |
| 18295 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18296 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18297 | } |
| 18298 | /* ***************** Mode3 ******************************/ |
| 18299 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18300 | unsigned int res) |
| 18301 | { |
| 18302 | switch (res >> 26) { |
| 18303 | case ALC880_HP_EVENT: |
| 18304 | alc663_two_hp_m1_speaker_automute(codec); |
| 18305 | break; |
| 18306 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18307 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18308 | break; |
| 18309 | } |
| 18310 | } |
| 18311 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18312 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18313 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18314 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18315 | { |
| 18316 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18317 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18318 | } |
| 18319 | /* ***************** Mode4 ******************************/ |
| 18320 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18321 | unsigned int res) |
| 18322 | { |
| 18323 | switch (res >> 26) { |
| 18324 | case ALC880_HP_EVENT: |
| 18325 | alc663_21jd_two_speaker_automute(codec); |
| 18326 | break; |
| 18327 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18328 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18329 | break; |
| 18330 | } |
| 18331 | } |
| 18332 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18333 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18334 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18335 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18336 | { |
| 18337 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18338 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18339 | } |
| 18340 | /* ***************** Mode5 ******************************/ |
| 18341 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18342 | unsigned int res) |
| 18343 | { |
| 18344 | switch (res >> 26) { |
| 18345 | case ALC880_HP_EVENT: |
| 18346 | alc663_15jd_two_speaker_automute(codec); |
| 18347 | break; |
| 18348 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18349 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18350 | break; |
| 18351 | } |
| 18352 | } |
| 18353 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18354 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18355 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18356 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18357 | { |
| 18358 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18359 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18360 | } |
| 18361 | /* ***************** Mode6 ******************************/ |
| 18362 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18363 | unsigned int res) |
| 18364 | { |
| 18365 | switch (res >> 26) { |
| 18366 | case ALC880_HP_EVENT: |
| 18367 | alc663_two_hp_m2_speaker_automute(codec); |
| 18368 | break; |
| 18369 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18370 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18371 | break; |
| 18372 | } |
| 18373 | } |
| 18374 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18375 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18376 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18377 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18378 | { |
| 18379 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18380 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18381 | } |
| 18382 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18383 | /* ***************** Mode7 ******************************/ |
| 18384 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18385 | unsigned int res) |
| 18386 | { |
| 18387 | switch (res >> 26) { |
| 18388 | case ALC880_HP_EVENT: |
| 18389 | alc663_two_hp_m7_speaker_automute(codec); |
| 18390 | break; |
| 18391 | case ALC880_MIC_EVENT: |
| 18392 | alc_mic_automute(codec); |
| 18393 | break; |
| 18394 | } |
| 18395 | } |
| 18396 | |
| 18397 | #define alc663_mode7_setup alc663_mode1_setup |
| 18398 | |
| 18399 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18400 | { |
| 18401 | alc663_two_hp_m7_speaker_automute(codec); |
| 18402 | alc_mic_automute(codec); |
| 18403 | } |
| 18404 | |
| 18405 | /* ***************** Mode8 ******************************/ |
| 18406 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18407 | unsigned int res) |
| 18408 | { |
| 18409 | switch (res >> 26) { |
| 18410 | case ALC880_HP_EVENT: |
| 18411 | alc663_two_hp_m8_speaker_automute(codec); |
| 18412 | break; |
| 18413 | case ALC880_MIC_EVENT: |
| 18414 | alc_mic_automute(codec); |
| 18415 | break; |
| 18416 | } |
| 18417 | } |
| 18418 | |
| 18419 | #define alc663_mode8_setup alc663_m51va_setup |
| 18420 | |
| 18421 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18422 | { |
| 18423 | alc663_two_hp_m8_speaker_automute(codec); |
| 18424 | alc_mic_automute(codec); |
| 18425 | } |
| 18426 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18427 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18428 | { |
| 18429 | unsigned int present; |
| 18430 | unsigned char bits; |
| 18431 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18432 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18433 | bits = present ? HDA_AMP_MUTE : 0; |
| 18434 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18435 | HDA_AMP_MUTE, bits); |
| 18436 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18437 | HDA_AMP_MUTE, bits); |
| 18438 | } |
| 18439 | |
| 18440 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18441 | { |
| 18442 | unsigned int present; |
| 18443 | unsigned char bits; |
| 18444 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18445 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18446 | bits = present ? HDA_AMP_MUTE : 0; |
| 18447 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18448 | HDA_AMP_MUTE, bits); |
| 18449 | } |
| 18450 | |
| 18451 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18452 | unsigned int res) |
| 18453 | { |
| 18454 | switch (res >> 26) { |
| 18455 | case ALC880_HP_EVENT: |
| 18456 | alc663_g71v_hp_automute(codec); |
| 18457 | break; |
| 18458 | case ALC880_FRONT_EVENT: |
| 18459 | alc663_g71v_front_automute(codec); |
| 18460 | break; |
| 18461 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18462 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18463 | break; |
| 18464 | } |
| 18465 | } |
| 18466 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18467 | #define alc663_g71v_setup alc663_m51va_setup |
| 18468 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18469 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18470 | { |
| 18471 | alc663_g71v_front_automute(codec); |
| 18472 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18473 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18474 | } |
| 18475 | |
| 18476 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18477 | unsigned int res) |
| 18478 | { |
| 18479 | switch (res >> 26) { |
| 18480 | case ALC880_HP_EVENT: |
| 18481 | alc663_m51va_speaker_automute(codec); |
| 18482 | break; |
| 18483 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18484 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18485 | break; |
| 18486 | } |
| 18487 | } |
| 18488 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18489 | #define alc663_g50v_setup alc663_m51va_setup |
| 18490 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18491 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18492 | { |
| 18493 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18494 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18495 | } |
| 18496 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18497 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18498 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18499 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18500 | |
| 18501 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18502 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18503 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18504 | |
| 18505 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18506 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18507 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18508 | { } /* end */ |
| 18509 | }; |
| 18510 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18511 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18512 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18513 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18514 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18515 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18516 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18517 | |
| 18518 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18519 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18520 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18521 | |
| 18522 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18523 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18524 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18525 | { } /* end */ |
| 18526 | }; |
| 18527 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18528 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18529 | #define alc662_loopbacks alc880_loopbacks |
| 18530 | #endif |
| 18531 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18532 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18533 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18534 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18535 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18536 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18537 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18538 | |
| 18539 | /* |
| 18540 | * configuration and preset |
| 18541 | */ |
| 18542 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18543 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18544 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18545 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18546 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18547 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18548 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18549 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18550 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18551 | [ALC663_ASUS_M51VA] = "m51va", |
| 18552 | [ALC663_ASUS_G71V] = "g71v", |
| 18553 | [ALC663_ASUS_H13] = "h13", |
| 18554 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18555 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18556 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18557 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18558 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18559 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18560 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18561 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18562 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18563 | [ALC272_DELL] = "dell", |
| 18564 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18565 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18566 | [ALC662_AUTO] = "auto", |
| 18567 | }; |
| 18568 | |
| 18569 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18570 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18571 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18572 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18573 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18574 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18575 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18576 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18577 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18578 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18579 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18580 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18581 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18582 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18583 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18584 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18585 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18586 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18587 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18588 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18589 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18590 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18591 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18592 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18593 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18594 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18595 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18596 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18597 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18598 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18599 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18600 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18601 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18602 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18603 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18604 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18605 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18606 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18607 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18608 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18609 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18610 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18611 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18612 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18613 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18614 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18615 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18616 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18617 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18618 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18619 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18620 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18621 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18622 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18623 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18624 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18625 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18626 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18627 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18628 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18629 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18630 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18631 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18632 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18633 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18634 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18635 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18636 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18637 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18638 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18639 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18640 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18641 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18642 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18643 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18644 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18645 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18646 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18647 | {} |
| 18648 | }; |
| 18649 | |
| 18650 | static struct alc_config_preset alc662_presets[] = { |
| 18651 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18652 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18653 | .init_verbs = { alc662_init_verbs }, |
| 18654 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18655 | .dac_nids = alc662_dac_nids, |
| 18656 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18657 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18658 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18659 | .channel_mode = alc662_3ST_2ch_modes, |
| 18660 | .input_mux = &alc662_capture_source, |
| 18661 | }, |
| 18662 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18663 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18664 | .init_verbs = { alc662_init_verbs }, |
| 18665 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18666 | .dac_nids = alc662_dac_nids, |
| 18667 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18668 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18669 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18670 | .channel_mode = alc662_3ST_6ch_modes, |
| 18671 | .need_dac_fix = 1, |
| 18672 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18673 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18674 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18675 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18676 | .init_verbs = { alc662_init_verbs }, |
| 18677 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18678 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18679 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18680 | .channel_mode = alc662_3ST_6ch_modes, |
| 18681 | .need_dac_fix = 1, |
| 18682 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18683 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18684 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18685 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18686 | .init_verbs = { alc662_init_verbs }, |
| 18687 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18688 | .dac_nids = alc662_dac_nids, |
| 18689 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18690 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18691 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18692 | .channel_mode = alc662_5stack_modes, |
| 18693 | .input_mux = &alc662_capture_source, |
| 18694 | }, |
| 18695 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18696 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18697 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18698 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18699 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18700 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18701 | .channel_mode = alc662_3ST_2ch_modes, |
| 18702 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18703 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18704 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18705 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18706 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18707 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18708 | .init_verbs = { alc662_init_verbs, |
| 18709 | alc662_eeepc_sue_init_verbs }, |
| 18710 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18711 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18712 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18713 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18714 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18715 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18716 | .init_hook = alc662_eeepc_inithook, |
| 18717 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18718 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18719 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18720 | alc662_chmode_mixer }, |
| 18721 | .init_verbs = { alc662_init_verbs, |
| 18722 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18723 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18724 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18725 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18726 | .channel_mode = alc662_3ST_6ch_modes, |
| 18727 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18728 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18729 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18730 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18731 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18732 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18733 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18734 | .init_verbs = { alc662_init_verbs, |
| 18735 | alc662_ecs_init_verbs }, |
| 18736 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18737 | .dac_nids = alc662_dac_nids, |
| 18738 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18739 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18740 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18741 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18742 | .init_hook = alc662_eeepc_inithook, |
| 18743 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18744 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18745 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18746 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18747 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18748 | .dac_nids = alc662_dac_nids, |
| 18749 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18750 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18751 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18752 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18753 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18754 | .init_hook = alc663_m51va_inithook, |
| 18755 | }, |
| 18756 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18757 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18758 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18759 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18760 | .dac_nids = alc662_dac_nids, |
| 18761 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18762 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18763 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18764 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18765 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18766 | .init_hook = alc663_g71v_inithook, |
| 18767 | }, |
| 18768 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18769 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18770 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18771 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18772 | .dac_nids = alc662_dac_nids, |
| 18773 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18774 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18775 | .unsol_event = alc663_m51va_unsol_event, |
| 18776 | .init_hook = alc663_m51va_inithook, |
| 18777 | }, |
| 18778 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18779 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18780 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18781 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18782 | .dac_nids = alc662_dac_nids, |
| 18783 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18784 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18785 | .channel_mode = alc662_3ST_6ch_modes, |
| 18786 | .input_mux = &alc663_capture_source, |
| 18787 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18788 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18789 | .init_hook = alc663_g50v_inithook, |
| 18790 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18791 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18792 | .mixers = { alc663_m51va_mixer }, |
| 18793 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18794 | .init_verbs = { alc662_init_verbs, |
| 18795 | alc663_21jd_amic_init_verbs }, |
| 18796 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18797 | .hp_nid = 0x03, |
| 18798 | .dac_nids = alc662_dac_nids, |
| 18799 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18800 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18801 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18802 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18803 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18804 | .init_hook = alc663_mode1_inithook, |
| 18805 | }, |
| 18806 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18807 | .mixers = { alc662_1bjd_mixer }, |
| 18808 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18809 | .init_verbs = { alc662_init_verbs, |
| 18810 | alc662_1bjd_amic_init_verbs }, |
| 18811 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18812 | .dac_nids = alc662_dac_nids, |
| 18813 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18814 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18815 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18816 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18817 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18818 | .init_hook = alc662_mode2_inithook, |
| 18819 | }, |
| 18820 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18821 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18822 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18823 | .init_verbs = { alc662_init_verbs, |
| 18824 | alc663_two_hp_amic_m1_init_verbs }, |
| 18825 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18826 | .hp_nid = 0x03, |
| 18827 | .dac_nids = alc662_dac_nids, |
| 18828 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18829 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18830 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18831 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18832 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18833 | .init_hook = alc663_mode3_inithook, |
| 18834 | }, |
| 18835 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18836 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18837 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18838 | .init_verbs = { alc662_init_verbs, |
| 18839 | alc663_21jd_amic_init_verbs}, |
| 18840 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18841 | .hp_nid = 0x03, |
| 18842 | .dac_nids = alc662_dac_nids, |
| 18843 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18844 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18845 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18846 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18847 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18848 | .init_hook = alc663_mode4_inithook, |
| 18849 | }, |
| 18850 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18851 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18852 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18853 | .init_verbs = { alc662_init_verbs, |
| 18854 | alc663_15jd_amic_init_verbs }, |
| 18855 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18856 | .hp_nid = 0x03, |
| 18857 | .dac_nids = alc662_dac_nids, |
| 18858 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18859 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18860 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18861 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18862 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18863 | .init_hook = alc663_mode5_inithook, |
| 18864 | }, |
| 18865 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18866 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18867 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18868 | .init_verbs = { alc662_init_verbs, |
| 18869 | alc663_two_hp_amic_m2_init_verbs }, |
| 18870 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18871 | .hp_nid = 0x03, |
| 18872 | .dac_nids = alc662_dac_nids, |
| 18873 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18874 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18875 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18876 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18877 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18878 | .init_hook = alc663_mode6_inithook, |
| 18879 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18880 | [ALC663_ASUS_MODE7] = { |
| 18881 | .mixers = { alc663_mode7_mixer }, |
| 18882 | .cap_mixer = alc662_auto_capture_mixer, |
| 18883 | .init_verbs = { alc662_init_verbs, |
| 18884 | alc663_mode7_init_verbs }, |
| 18885 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18886 | .hp_nid = 0x03, |
| 18887 | .dac_nids = alc662_dac_nids, |
| 18888 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18889 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18890 | .channel_mode = alc662_3ST_2ch_modes, |
| 18891 | .unsol_event = alc663_mode7_unsol_event, |
| 18892 | .setup = alc663_mode7_setup, |
| 18893 | .init_hook = alc663_mode7_inithook, |
| 18894 | }, |
| 18895 | [ALC663_ASUS_MODE8] = { |
| 18896 | .mixers = { alc663_mode8_mixer }, |
| 18897 | .cap_mixer = alc662_auto_capture_mixer, |
| 18898 | .init_verbs = { alc662_init_verbs, |
| 18899 | alc663_mode8_init_verbs }, |
| 18900 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18901 | .hp_nid = 0x03, |
| 18902 | .dac_nids = alc662_dac_nids, |
| 18903 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18904 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18905 | .channel_mode = alc662_3ST_2ch_modes, |
| 18906 | .unsol_event = alc663_mode8_unsol_event, |
| 18907 | .setup = alc663_mode8_setup, |
| 18908 | .init_hook = alc663_mode8_inithook, |
| 18909 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18910 | [ALC272_DELL] = { |
| 18911 | .mixers = { alc663_m51va_mixer }, |
| 18912 | .cap_mixer = alc272_auto_capture_mixer, |
| 18913 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18914 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18915 | .dac_nids = alc662_dac_nids, |
| 18916 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18917 | .adc_nids = alc272_adc_nids, |
| 18918 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18919 | .capsrc_nids = alc272_capsrc_nids, |
| 18920 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18921 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18922 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18923 | .init_hook = alc663_m51va_inithook, |
| 18924 | }, |
| 18925 | [ALC272_DELL_ZM1] = { |
| 18926 | .mixers = { alc663_m51va_mixer }, |
| 18927 | .cap_mixer = alc662_auto_capture_mixer, |
| 18928 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18929 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18930 | .dac_nids = alc662_dac_nids, |
| 18931 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18932 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18933 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18934 | .capsrc_nids = alc662_capsrc_nids, |
| 18935 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18936 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18937 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18938 | .init_hook = alc663_m51va_inithook, |
| 18939 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18940 | [ALC272_SAMSUNG_NC10] = { |
| 18941 | .mixers = { alc272_nc10_mixer }, |
| 18942 | .init_verbs = { alc662_init_verbs, |
| 18943 | alc663_21jd_amic_init_verbs }, |
| 18944 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18945 | .dac_nids = alc272_dac_nids, |
| 18946 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18947 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18948 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18949 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18950 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18951 | .init_hook = alc663_mode4_inithook, |
| 18952 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18953 | }; |
| 18954 | |
| 18955 | |
| 18956 | /* |
| 18957 | * BIOS auto configuration |
| 18958 | */ |
| 18959 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18960 | /* convert from MIX nid to DAC */ |
| 18961 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18962 | { |
| 18963 | if (nid == 0x0f) |
| 18964 | return 0x02; |
| 18965 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18966 | return nid - 0x0c + 0x02; |
| 18967 | else |
| 18968 | return 0; |
| 18969 | } |
| 18970 | |
| 18971 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18972 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18973 | hda_nid_t dac) |
| 18974 | { |
| 18975 | hda_nid_t mix[4]; |
| 18976 | int i, num; |
| 18977 | |
| 18978 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18979 | for (i = 0; i < num; i++) { |
| 18980 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18981 | return mix[i]; |
| 18982 | } |
| 18983 | return 0; |
| 18984 | } |
| 18985 | |
| 18986 | /* look for an empty DAC slot */ |
| 18987 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18988 | { |
| 18989 | struct alc_spec *spec = codec->spec; |
| 18990 | hda_nid_t srcs[5]; |
| 18991 | int i, j, num; |
| 18992 | |
| 18993 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18994 | if (num < 0) |
| 18995 | return 0; |
| 18996 | for (i = 0; i < num; i++) { |
| 18997 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18998 | if (!nid) |
| 18999 | continue; |
| 19000 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19001 | if (spec->multiout.dac_nids[j] == nid) |
| 19002 | break; |
| 19003 | if (j >= spec->multiout.num_dacs) |
| 19004 | return nid; |
| 19005 | } |
| 19006 | return 0; |
| 19007 | } |
| 19008 | |
| 19009 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19010 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19011 | const struct auto_pin_cfg *cfg) |
| 19012 | { |
| 19013 | struct alc_spec *spec = codec->spec; |
| 19014 | int i; |
| 19015 | hda_nid_t dac; |
| 19016 | |
| 19017 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19018 | for (i = 0; i < cfg->line_outs; i++) { |
| 19019 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19020 | if (!dac) |
| 19021 | continue; |
| 19022 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19023 | } |
| 19024 | return 0; |
| 19025 | } |
| 19026 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19027 | 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] | 19028 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19029 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19030 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19031 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19032 | } |
| 19033 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19034 | 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] | 19035 | hda_nid_t nid, unsigned int chs) |
| 19036 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19037 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19038 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19039 | } |
| 19040 | |
| 19041 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19042 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19043 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19044 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19045 | |
| 19046 | /* add playback controls from the parsed DAC table */ |
| 19047 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19048 | const struct auto_pin_cfg *cfg) |
| 19049 | { |
| 19050 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19051 | static const char *chname[4] = { |
| 19052 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19053 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19054 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19055 | int i, err; |
| 19056 | |
| 19057 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19058 | nid = spec->multiout.dac_nids[i]; |
| 19059 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19060 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19061 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19062 | if (!mix) |
| 19063 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19064 | if (i == 2) { |
| 19065 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19066 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19067 | if (err < 0) |
| 19068 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19069 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19070 | if (err < 0) |
| 19071 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19072 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19073 | if (err < 0) |
| 19074 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19075 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19076 | if (err < 0) |
| 19077 | return err; |
| 19078 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19079 | const char *pfx; |
| 19080 | if (cfg->line_outs == 1 && |
| 19081 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19082 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19083 | pfx = "Speaker"; |
| 19084 | else |
| 19085 | pfx = "PCM"; |
| 19086 | } else |
| 19087 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19088 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19089 | if (err < 0) |
| 19090 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19091 | if (cfg->line_outs == 1 && |
| 19092 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19093 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19094 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19095 | if (err < 0) |
| 19096 | return err; |
| 19097 | } |
| 19098 | } |
| 19099 | return 0; |
| 19100 | } |
| 19101 | |
| 19102 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19103 | /* return DAC nid if any new DAC is assigned */ |
| 19104 | 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] | 19105 | const char *pfx) |
| 19106 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19107 | struct alc_spec *spec = codec->spec; |
| 19108 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19109 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19110 | |
| 19111 | if (!pin) |
| 19112 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19113 | nid = alc662_look_for_dac(codec, pin); |
| 19114 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19115 | /* the corresponding DAC is already occupied */ |
| 19116 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19117 | return 0; /* no way */ |
| 19118 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19119 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19120 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19121 | } |
| 19122 | |
| 19123 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19124 | if (!mix) |
| 19125 | return 0; |
| 19126 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19127 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19128 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19129 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19130 | if (err < 0) |
| 19131 | return err; |
| 19132 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19133 | } |
| 19134 | |
| 19135 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19136 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19137 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19138 | |
| 19139 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19140 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19141 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19142 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19143 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19144 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19145 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19146 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19147 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19148 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19149 | if (num <= 1) |
| 19150 | return; |
| 19151 | for (i = 0; i < num; i++) { |
| 19152 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19153 | continue; |
| 19154 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19155 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19156 | } |
| 19157 | } |
| 19158 | |
| 19159 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19160 | { |
| 19161 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19162 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19163 | int i; |
| 19164 | |
| 19165 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19166 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19167 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19168 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19169 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19170 | } |
| 19171 | } |
| 19172 | |
| 19173 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19174 | { |
| 19175 | struct alc_spec *spec = codec->spec; |
| 19176 | hda_nid_t pin; |
| 19177 | |
| 19178 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19179 | if (pin) |
| 19180 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19181 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19182 | pin = spec->autocfg.speaker_pins[0]; |
| 19183 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19184 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19185 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19186 | } |
| 19187 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19188 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19189 | |
| 19190 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19191 | { |
| 19192 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19193 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19194 | int i; |
| 19195 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19196 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19197 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19198 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19199 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19200 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19201 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19202 | snd_hda_codec_write(codec, nid, 0, |
| 19203 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19204 | AMP_OUT_MUTE); |
| 19205 | } |
| 19206 | } |
| 19207 | } |
| 19208 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19209 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19210 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19211 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19212 | { |
| 19213 | struct alc_spec *spec = codec->spec; |
| 19214 | int err; |
| 19215 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19216 | |
| 19217 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19218 | alc662_ignore); |
| 19219 | if (err < 0) |
| 19220 | return err; |
| 19221 | if (!spec->autocfg.line_outs) |
| 19222 | return 0; /* can't find valid BIOS pin config */ |
| 19223 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19224 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19225 | if (err < 0) |
| 19226 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19227 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19228 | if (err < 0) |
| 19229 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19230 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19231 | spec->autocfg.speaker_pins[0], |
| 19232 | "Speaker"); |
| 19233 | if (err < 0) |
| 19234 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19235 | if (err) |
| 19236 | spec->multiout.extra_out_nid[0] = err; |
| 19237 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19238 | "Headphone"); |
| 19239 | if (err < 0) |
| 19240 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19241 | if (err) |
| 19242 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19243 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19244 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19245 | return err; |
| 19246 | |
| 19247 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19248 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19249 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19250 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19251 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19252 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19253 | |
| 19254 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19255 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19256 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19257 | add_verb(spec, alc662_init_verbs); |
| 19258 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19259 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19260 | add_verb(spec, alc663_init_verbs); |
| 19261 | |
| 19262 | if (codec->vendor_id == 0x10ec0272) |
| 19263 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19264 | |
| 19265 | err = alc_auto_add_mic_boost(codec); |
| 19266 | if (err < 0) |
| 19267 | return err; |
| 19268 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19269 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19270 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19271 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19272 | else |
| 19273 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19274 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19275 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19276 | } |
| 19277 | |
| 19278 | /* additional initialization for auto-configuration model */ |
| 19279 | static void alc662_auto_init(struct hda_codec *codec) |
| 19280 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19281 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19282 | alc662_auto_init_multi_out(codec); |
| 19283 | alc662_auto_init_hp_out(codec); |
| 19284 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19285 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19286 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19287 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19288 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19289 | } |
| 19290 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19291 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19292 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19293 | ALC662_FIXUP_IDEAPAD, |
| 19294 | }; |
| 19295 | |
| 19296 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19297 | [ALC662_FIXUP_ASPIRE] = { |
| 19298 | .pins = (const struct alc_pincfg[]) { |
| 19299 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19300 | { } |
| 19301 | } |
| 19302 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19303 | [ALC662_FIXUP_IDEAPAD] = { |
| 19304 | .pins = (const struct alc_pincfg[]) { |
| 19305 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19306 | { } |
| 19307 | } |
| 19308 | }, |
| 19309 | }; |
| 19310 | |
| 19311 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19312 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19313 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19314 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19315 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19316 | {} |
| 19317 | }; |
| 19318 | |
| 19319 | |
| 19320 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19321 | static int patch_alc662(struct hda_codec *codec) |
| 19322 | { |
| 19323 | struct alc_spec *spec; |
| 19324 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19325 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19326 | |
| 19327 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19328 | if (!spec) |
| 19329 | return -ENOMEM; |
| 19330 | |
| 19331 | codec->spec = spec; |
| 19332 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19333 | alc_auto_parse_customize_define(codec); |
| 19334 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19335 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19336 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19337 | coef = alc_read_coef_idx(codec, 0); |
| 19338 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19339 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19340 | else if (coef & (1 << 14) && |
| 19341 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19342 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19343 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19344 | else if (coef == 0x4011) |
| 19345 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19346 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19347 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19348 | alc662_models, |
| 19349 | alc662_cfg_tbl); |
| 19350 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19351 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19352 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19353 | board_config = ALC662_AUTO; |
| 19354 | } |
| 19355 | |
| 19356 | if (board_config == ALC662_AUTO) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19357 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19358 | /* automatic parse from the BIOS config */ |
| 19359 | err = alc662_parse_auto_config(codec); |
| 19360 | if (err < 0) { |
| 19361 | alc_free(codec); |
| 19362 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19363 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19364 | printk(KERN_INFO |
| 19365 | "hda_codec: Cannot set up configuration " |
| 19366 | "from BIOS. Using base mode...\n"); |
| 19367 | board_config = ALC662_3ST_2ch_DIG; |
| 19368 | } |
| 19369 | } |
| 19370 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19371 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19372 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19373 | if (err < 0) { |
| 19374 | alc_free(codec); |
| 19375 | return err; |
| 19376 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19377 | } |
| 19378 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19379 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19380 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19381 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19382 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19383 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19384 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19385 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19386 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19387 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19388 | if (!spec->adc_nids) { |
| 19389 | spec->adc_nids = alc662_adc_nids; |
| 19390 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19391 | } |
| 19392 | if (!spec->capsrc_nids) |
| 19393 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19394 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19395 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19396 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19397 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19398 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19399 | switch (codec->vendor_id) { |
| 19400 | case 0x10ec0662: |
| 19401 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19402 | break; |
| 19403 | case 0x10ec0272: |
| 19404 | case 0x10ec0663: |
| 19405 | case 0x10ec0665: |
| 19406 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19407 | break; |
| 19408 | case 0x10ec0273: |
| 19409 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19410 | break; |
| 19411 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19412 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19413 | spec->vmaster_nid = 0x02; |
| 19414 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19415 | codec->patch_ops = alc_patch_ops; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19416 | if (board_config == ALC662_AUTO) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19417 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19418 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
| 19419 | } |
| 19420 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19421 | alc_init_jacks(codec); |
| 19422 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19423 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19424 | if (!spec->loopback.amplist) |
| 19425 | spec->loopback.amplist = alc662_loopbacks; |
| 19426 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19427 | |
| 19428 | return 0; |
| 19429 | } |
| 19430 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19431 | static int patch_alc888(struct hda_codec *codec) |
| 19432 | { |
| 19433 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19434 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19435 | if (codec->vendor_id == 0x10ec0887) |
| 19436 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19437 | else |
| 19438 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19439 | if (!codec->chip_name) { |
| 19440 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19441 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19442 | } |
| 19443 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19444 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19445 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19446 | } |
| 19447 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19448 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19449 | * ALC680 support |
| 19450 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19451 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19452 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19453 | #define alc680_modes alc260_modes |
| 19454 | |
| 19455 | static hda_nid_t alc680_dac_nids[3] = { |
| 19456 | /* Lout1, Lout2, hp */ |
| 19457 | 0x02, 0x03, 0x04 |
| 19458 | }; |
| 19459 | |
| 19460 | static hda_nid_t alc680_adc_nids[3] = { |
| 19461 | /* ADC0-2 */ |
| 19462 | /* DMIC, MIC, Line-in*/ |
| 19463 | 0x07, 0x08, 0x09 |
| 19464 | }; |
| 19465 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19466 | /* |
| 19467 | * Analog capture ADC cgange |
| 19468 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19469 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19470 | { |
| 19471 | struct alc_spec *spec = codec->spec; |
| 19472 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19473 | int pin_found = 0; |
| 19474 | int type_found = AUTO_PIN_LAST; |
| 19475 | hda_nid_t nid; |
| 19476 | int i; |
| 19477 | |
| 19478 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19479 | nid = cfg->inputs[i].pin; |
| 19480 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19481 | AC_PINCAP_PRES_DETECT)) |
| 19482 | continue; |
| 19483 | if (snd_hda_jack_detect(codec, nid)) { |
| 19484 | if (cfg->inputs[i].type < type_found) { |
| 19485 | type_found = cfg->inputs[i].type; |
| 19486 | pin_found = nid; |
| 19487 | } |
| 19488 | } |
| 19489 | } |
| 19490 | |
| 19491 | nid = 0x07; |
| 19492 | if (pin_found) |
| 19493 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19494 | |
| 19495 | if (nid != spec->cur_adc) |
| 19496 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19497 | spec->cur_adc = nid; |
| 19498 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19499 | spec->cur_adc_format); |
| 19500 | } |
| 19501 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19502 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19503 | struct hda_codec *codec, |
| 19504 | unsigned int stream_tag, |
| 19505 | unsigned int format, |
| 19506 | struct snd_pcm_substream *substream) |
| 19507 | { |
| 19508 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19509 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19510 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19511 | spec->cur_adc_stream_tag = stream_tag; |
| 19512 | spec->cur_adc_format = format; |
| 19513 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19514 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19515 | return 0; |
| 19516 | } |
| 19517 | |
| 19518 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19519 | struct hda_codec *codec, |
| 19520 | struct snd_pcm_substream *substream) |
| 19521 | { |
| 19522 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19523 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19524 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19525 | return 0; |
| 19526 | } |
| 19527 | |
| 19528 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19529 | .substreams = 1, /* can be overridden */ |
| 19530 | .channels_min = 2, |
| 19531 | .channels_max = 2, |
| 19532 | /* NID is set in alc_build_pcms */ |
| 19533 | .ops = { |
| 19534 | .prepare = alc680_capture_pcm_prepare, |
| 19535 | .cleanup = alc680_capture_pcm_cleanup |
| 19536 | }, |
| 19537 | }; |
| 19538 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19539 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19540 | /* output mixer control */ |
| 19541 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19542 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19543 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19544 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19545 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19546 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19547 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19548 | { } |
| 19549 | }; |
| 19550 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19551 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19552 | .ops = &snd_hda_bind_vol, |
| 19553 | .values = { |
| 19554 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19555 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19556 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19557 | 0 |
| 19558 | }, |
| 19559 | }; |
| 19560 | |
| 19561 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19562 | .ops = &snd_hda_bind_sw, |
| 19563 | .values = { |
| 19564 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19565 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19566 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19567 | 0 |
| 19568 | }, |
| 19569 | }; |
| 19570 | |
| 19571 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19572 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19573 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19574 | { } /* end */ |
| 19575 | }; |
| 19576 | |
| 19577 | /* |
| 19578 | * generic initialization of ADC, input mixers and output mixers |
| 19579 | */ |
| 19580 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19581 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19582 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19583 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19584 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19585 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19586 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19587 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19588 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19589 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19590 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19591 | |
| 19592 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19593 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19594 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19595 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19596 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19597 | |
| 19598 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19599 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19600 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19601 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19602 | { } |
| 19603 | }; |
| 19604 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19605 | /* toggle speaker-output according to the hp-jack state */ |
| 19606 | static void alc680_base_setup(struct hda_codec *codec) |
| 19607 | { |
| 19608 | struct alc_spec *spec = codec->spec; |
| 19609 | |
| 19610 | spec->autocfg.hp_pins[0] = 0x16; |
| 19611 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19612 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19613 | spec->autocfg.num_inputs = 2; |
| 19614 | spec->autocfg.inputs[0].pin = 0x18; |
| 19615 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19616 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19617 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19618 | } |
| 19619 | |
| 19620 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19621 | unsigned int res) |
| 19622 | { |
| 19623 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19624 | alc_automute_amp(codec); |
| 19625 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19626 | alc680_rec_autoswitch(codec); |
| 19627 | } |
| 19628 | |
| 19629 | static void alc680_inithook(struct hda_codec *codec) |
| 19630 | { |
| 19631 | alc_automute_amp(codec); |
| 19632 | alc680_rec_autoswitch(codec); |
| 19633 | } |
| 19634 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19635 | /* create input playback/capture controls for the given pin */ |
| 19636 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19637 | const char *ctlname, int idx) |
| 19638 | { |
| 19639 | hda_nid_t dac; |
| 19640 | int err; |
| 19641 | |
| 19642 | switch (nid) { |
| 19643 | case 0x14: |
| 19644 | dac = 0x02; |
| 19645 | break; |
| 19646 | case 0x15: |
| 19647 | dac = 0x03; |
| 19648 | break; |
| 19649 | case 0x16: |
| 19650 | dac = 0x04; |
| 19651 | break; |
| 19652 | default: |
| 19653 | return 0; |
| 19654 | } |
| 19655 | if (spec->multiout.dac_nids[0] != dac && |
| 19656 | spec->multiout.dac_nids[1] != dac) { |
| 19657 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19658 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19659 | HDA_OUTPUT)); |
| 19660 | if (err < 0) |
| 19661 | return err; |
| 19662 | |
| 19663 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19664 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19665 | |
| 19666 | if (err < 0) |
| 19667 | return err; |
| 19668 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19669 | } |
| 19670 | |
| 19671 | return 0; |
| 19672 | } |
| 19673 | |
| 19674 | /* add playback controls from the parsed DAC table */ |
| 19675 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19676 | const struct auto_pin_cfg *cfg) |
| 19677 | { |
| 19678 | hda_nid_t nid; |
| 19679 | int err; |
| 19680 | |
| 19681 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19682 | |
| 19683 | nid = cfg->line_out_pins[0]; |
| 19684 | if (nid) { |
| 19685 | const char *name; |
| 19686 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19687 | name = "Speaker"; |
| 19688 | else |
| 19689 | name = "Front"; |
| 19690 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19691 | if (err < 0) |
| 19692 | return err; |
| 19693 | } |
| 19694 | |
| 19695 | nid = cfg->speaker_pins[0]; |
| 19696 | if (nid) { |
| 19697 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19698 | if (err < 0) |
| 19699 | return err; |
| 19700 | } |
| 19701 | nid = cfg->hp_pins[0]; |
| 19702 | if (nid) { |
| 19703 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19704 | if (err < 0) |
| 19705 | return err; |
| 19706 | } |
| 19707 | |
| 19708 | return 0; |
| 19709 | } |
| 19710 | |
| 19711 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19712 | hda_nid_t nid, int pin_type) |
| 19713 | { |
| 19714 | alc_set_pin_output(codec, nid, pin_type); |
| 19715 | } |
| 19716 | |
| 19717 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19718 | { |
| 19719 | struct alc_spec *spec = codec->spec; |
| 19720 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19721 | if (nid) { |
| 19722 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19723 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19724 | } |
| 19725 | } |
| 19726 | |
| 19727 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19728 | { |
| 19729 | struct alc_spec *spec = codec->spec; |
| 19730 | hda_nid_t pin; |
| 19731 | |
| 19732 | pin = spec->autocfg.hp_pins[0]; |
| 19733 | if (pin) |
| 19734 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19735 | pin = spec->autocfg.speaker_pins[0]; |
| 19736 | if (pin) |
| 19737 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19738 | } |
| 19739 | |
| 19740 | /* pcm configuration: identical with ALC880 */ |
| 19741 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19742 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19743 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19744 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19745 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19746 | |
| 19747 | /* |
| 19748 | * BIOS auto configuration |
| 19749 | */ |
| 19750 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19751 | { |
| 19752 | struct alc_spec *spec = codec->spec; |
| 19753 | int err; |
| 19754 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19755 | |
| 19756 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19757 | alc680_ignore); |
| 19758 | if (err < 0) |
| 19759 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19760 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19761 | if (!spec->autocfg.line_outs) { |
| 19762 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19763 | spec->multiout.max_channels = 2; |
| 19764 | spec->no_analog = 1; |
| 19765 | goto dig_only; |
| 19766 | } |
| 19767 | return 0; /* can't find valid BIOS pin config */ |
| 19768 | } |
| 19769 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19770 | if (err < 0) |
| 19771 | return err; |
| 19772 | |
| 19773 | spec->multiout.max_channels = 2; |
| 19774 | |
| 19775 | dig_only: |
| 19776 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19777 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19778 | if (spec->kctls.list) |
| 19779 | add_mixer(spec, spec->kctls.list); |
| 19780 | |
| 19781 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19782 | |
| 19783 | err = alc_auto_add_mic_boost(codec); |
| 19784 | if (err < 0) |
| 19785 | return err; |
| 19786 | |
| 19787 | return 1; |
| 19788 | } |
| 19789 | |
| 19790 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19791 | |
| 19792 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19793 | static void alc680_auto_init(struct hda_codec *codec) |
| 19794 | { |
| 19795 | struct alc_spec *spec = codec->spec; |
| 19796 | alc680_auto_init_multi_out(codec); |
| 19797 | alc680_auto_init_hp_out(codec); |
| 19798 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19799 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19800 | if (spec->unsol_event) |
| 19801 | alc_inithook(codec); |
| 19802 | } |
| 19803 | |
| 19804 | /* |
| 19805 | * configuration and preset |
| 19806 | */ |
| 19807 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19808 | [ALC680_BASE] = "base", |
| 19809 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19810 | }; |
| 19811 | |
| 19812 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19813 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19814 | {} |
| 19815 | }; |
| 19816 | |
| 19817 | static struct alc_config_preset alc680_presets[] = { |
| 19818 | [ALC680_BASE] = { |
| 19819 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19820 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19821 | .init_verbs = { alc680_init_verbs }, |
| 19822 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19823 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19824 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19825 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19826 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19827 | .unsol_event = alc680_unsol_event, |
| 19828 | .setup = alc680_base_setup, |
| 19829 | .init_hook = alc680_inithook, |
| 19830 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19831 | }, |
| 19832 | }; |
| 19833 | |
| 19834 | static int patch_alc680(struct hda_codec *codec) |
| 19835 | { |
| 19836 | struct alc_spec *spec; |
| 19837 | int board_config; |
| 19838 | int err; |
| 19839 | |
| 19840 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19841 | if (spec == NULL) |
| 19842 | return -ENOMEM; |
| 19843 | |
| 19844 | codec->spec = spec; |
| 19845 | |
| 19846 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19847 | alc680_models, |
| 19848 | alc680_cfg_tbl); |
| 19849 | |
| 19850 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19851 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19852 | codec->chip_name); |
| 19853 | board_config = ALC680_AUTO; |
| 19854 | } |
| 19855 | |
| 19856 | if (board_config == ALC680_AUTO) { |
| 19857 | /* automatic parse from the BIOS config */ |
| 19858 | err = alc680_parse_auto_config(codec); |
| 19859 | if (err < 0) { |
| 19860 | alc_free(codec); |
| 19861 | return err; |
| 19862 | } else if (!err) { |
| 19863 | printk(KERN_INFO |
| 19864 | "hda_codec: Cannot set up configuration " |
| 19865 | "from BIOS. Using base mode...\n"); |
| 19866 | board_config = ALC680_BASE; |
| 19867 | } |
| 19868 | } |
| 19869 | |
| 19870 | if (board_config != ALC680_AUTO) |
| 19871 | setup_preset(codec, &alc680_presets[board_config]); |
| 19872 | |
| 19873 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19874 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19875 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19876 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19877 | |
| 19878 | if (!spec->adc_nids) { |
| 19879 | spec->adc_nids = alc680_adc_nids; |
| 19880 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19881 | } |
| 19882 | |
| 19883 | if (!spec->cap_mixer) |
| 19884 | set_capture_mixer(codec); |
| 19885 | |
| 19886 | spec->vmaster_nid = 0x02; |
| 19887 | |
| 19888 | codec->patch_ops = alc_patch_ops; |
| 19889 | if (board_config == ALC680_AUTO) |
| 19890 | spec->init_hook = alc680_auto_init; |
| 19891 | |
| 19892 | return 0; |
| 19893 | } |
| 19894 | |
| 19895 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19896 | * patch entries |
| 19897 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19898 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19899 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19900 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19901 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19902 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19903 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19904 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19905 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19906 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19907 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19908 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19909 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19910 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19911 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19912 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19913 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19914 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19915 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19916 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19917 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19918 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19919 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19920 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19921 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19922 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19923 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19924 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19925 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19926 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19927 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19928 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19929 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19930 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19931 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19932 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19933 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19934 | {} /* terminator */ |
| 19935 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19936 | |
| 19937 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19938 | |
| 19939 | MODULE_LICENSE("GPL"); |
| 19940 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19941 | |
| 19942 | static struct hda_codec_preset_list realtek_list = { |
| 19943 | .preset = snd_hda_preset_realtek, |
| 19944 | .owner = THIS_MODULE, |
| 19945 | }; |
| 19946 | |
| 19947 | static int __init patch_realtek_init(void) |
| 19948 | { |
| 19949 | return snd_hda_add_codec_preset(&realtek_list); |
| 19950 | } |
| 19951 | |
| 19952 | static void __exit patch_realtek_exit(void) |
| 19953 | { |
| 19954 | snd_hda_delete_codec_preset(&realtek_list); |
| 19955 | } |
| 19956 | |
| 19957 | module_init(patch_realtek_init) |
| 19958 | module_exit(patch_realtek_exit) |