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 | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 234 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 235 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 236 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 238 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 240 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 241 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 242 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 243 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 244 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 245 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 246 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 247 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 248 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 249 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 250 | ALC889A_INTEL, |
| 251 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 252 | ALC888_ASUS_M90V, |
| 253 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 254 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 255 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 256 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | a3f730a | 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 | 2880a867 | 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 | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 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 | 2880a867 | 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 | 2880a867 | 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 | 3e1647c | 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 | 3e1647c | 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 | 3e1647c | 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 | 3e1647c | 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 | 2880a867 | 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 | 3e1647c | 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 | bab282b | 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 | bab282b | 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 | bab282b | 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 | 2880a867 | 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 | 2880a867 | 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 | 2880a867 | 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 | 3e1647c | 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 | 3e1647c | 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 | a68d5a5 | 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, |
| 14626 | ALC269_TYPE_ALC259, |
| 14627 | ALC269_TYPE_ALC271X, |
| 14628 | }; |
| 14629 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14630 | /* |
| 14631 | * BIOS auto configuration |
| 14632 | */ |
| 14633 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14634 | { |
| 14635 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14636 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14637 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14638 | |
| 14639 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14640 | alc269_ignore); |
| 14641 | if (err < 0) |
| 14642 | return err; |
| 14643 | |
| 14644 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14645 | if (err < 0) |
| 14646 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14647 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14648 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14649 | else |
| 14650 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14651 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14652 | if (err < 0) |
| 14653 | return err; |
| 14654 | |
| 14655 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14656 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14657 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14658 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14659 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14660 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14661 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14662 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14663 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14664 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14665 | } else { |
| 14666 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14667 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14668 | } |
| 14669 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14670 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14671 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14672 | |
| 14673 | if (!alc275_setup_dual_adc(codec)) |
| 14674 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14675 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14676 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14677 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14678 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14679 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14680 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14681 | |
| 14682 | err = alc_auto_add_mic_boost(codec); |
| 14683 | if (err < 0) |
| 14684 | return err; |
| 14685 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14686 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14687 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14688 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14689 | return 1; |
| 14690 | } |
| 14691 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14692 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14693 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14694 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14695 | |
| 14696 | |
| 14697 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14698 | static void alc269_auto_init(struct hda_codec *codec) |
| 14699 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14700 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14701 | alc269_auto_init_multi_out(codec); |
| 14702 | alc269_auto_init_hp_out(codec); |
| 14703 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14704 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14705 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14706 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14707 | } |
| 14708 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14709 | #ifdef SND_HDA_NEEDS_RESUME |
| 14710 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14711 | { |
| 14712 | int val = alc_read_coef_idx(codec, 0x04); |
| 14713 | if (power_up) |
| 14714 | val |= 1 << 11; |
| 14715 | else |
| 14716 | val &= ~(1 << 11); |
| 14717 | alc_write_coef_idx(codec, 0x04, val); |
| 14718 | } |
| 14719 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14720 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14721 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14722 | { |
| 14723 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14724 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14725 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14726 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14727 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14728 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14729 | msleep(150); |
| 14730 | } |
| 14731 | |
| 14732 | alc_shutup(codec); |
| 14733 | if (spec && spec->power_hook) |
| 14734 | spec->power_hook(codec); |
| 14735 | return 0; |
| 14736 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14737 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14738 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14739 | static int alc269_resume(struct hda_codec *codec) |
| 14740 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14741 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14742 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14743 | msleep(150); |
| 14744 | } |
| 14745 | |
| 14746 | codec->patch_ops.init(codec); |
| 14747 | |
| 14748 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14749 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14750 | msleep(200); |
| 14751 | } |
| 14752 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14753 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14754 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14755 | |
| 14756 | snd_hda_codec_resume_amp(codec); |
| 14757 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14758 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14759 | return 0; |
| 14760 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14761 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14762 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14763 | enum { |
| 14764 | ALC269_FIXUP_SONY_VAIO, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14765 | ALC269_FIXUP_DELL_M101Z, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14766 | }; |
| 14767 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14768 | static const struct alc_fixup alc269_fixups[] = { |
| 14769 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14770 | .verbs = (const struct hda_verb[]) { |
| 14771 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14772 | {} |
| 14773 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14774 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14775 | [ALC269_FIXUP_DELL_M101Z] = { |
| 14776 | .verbs = (const struct hda_verb[]) { |
| 14777 | /* Enables internal speaker */ |
| 14778 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14779 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14780 | {} |
| 14781 | } |
| 14782 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14783 | }; |
| 14784 | |
| 14785 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | abdd8f5 | 2010-09-21 17:38:14 +0200 | [diff] [blame] | 14786 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14787 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14788 | {} |
| 14789 | }; |
| 14790 | |
| 14791 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14792 | /* |
| 14793 | * configuration and preset |
| 14794 | */ |
| 14795 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14796 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14797 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14798 | [ALC269_AMIC] = "laptop-amic", |
| 14799 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14800 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14801 | [ALC269_LIFEBOOK] = "lifebook", |
| 14802 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14803 | }; |
| 14804 | |
| 14805 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14806 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14807 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14808 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14809 | ALC269_AMIC), |
| 14810 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14811 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14812 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14813 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14814 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14815 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14816 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14817 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14818 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14819 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14820 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14821 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14822 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14823 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14824 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14825 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14826 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14827 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14828 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14829 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14830 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14831 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14832 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14833 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14834 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14835 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14836 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14837 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14838 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14839 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14840 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14841 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14842 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14843 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14844 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14845 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14846 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14847 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14848 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14849 | ALC269_DMIC), |
| 14850 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14851 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14852 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14853 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14854 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14855 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14856 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14857 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14858 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14859 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14860 | {} |
| 14861 | }; |
| 14862 | |
| 14863 | static struct alc_config_preset alc269_presets[] = { |
| 14864 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14865 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14866 | .init_verbs = { alc269_init_verbs }, |
| 14867 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14868 | .dac_nids = alc269_dac_nids, |
| 14869 | .hp_nid = 0x03, |
| 14870 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14871 | .channel_mode = alc269_modes, |
| 14872 | .input_mux = &alc269_capture_source, |
| 14873 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14874 | [ALC269_QUANTA_FL1] = { |
| 14875 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14876 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14877 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14878 | .dac_nids = alc269_dac_nids, |
| 14879 | .hp_nid = 0x03, |
| 14880 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14881 | .channel_mode = alc269_modes, |
| 14882 | .input_mux = &alc269_capture_source, |
| 14883 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14884 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14885 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14886 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14887 | [ALC269_AMIC] = { |
| 14888 | .mixers = { alc269_laptop_mixer }, |
| 14889 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14890 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14891 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14892 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14893 | .dac_nids = alc269_dac_nids, |
| 14894 | .hp_nid = 0x03, |
| 14895 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14896 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14897 | .unsol_event = alc269_laptop_unsol_event, |
| 14898 | .setup = alc269_laptop_amic_setup, |
| 14899 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14900 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14901 | [ALC269_DMIC] = { |
| 14902 | .mixers = { alc269_laptop_mixer }, |
| 14903 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14904 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14905 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14906 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14907 | .dac_nids = alc269_dac_nids, |
| 14908 | .hp_nid = 0x03, |
| 14909 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14910 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14911 | .unsol_event = alc269_laptop_unsol_event, |
| 14912 | .setup = alc269_laptop_dmic_setup, |
| 14913 | .init_hook = alc269_laptop_inithook, |
| 14914 | }, |
| 14915 | [ALC269VB_AMIC] = { |
| 14916 | .mixers = { alc269vb_laptop_mixer }, |
| 14917 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14918 | .init_verbs = { alc269vb_init_verbs, |
| 14919 | alc269vb_laptop_amic_init_verbs }, |
| 14920 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14921 | .dac_nids = alc269_dac_nids, |
| 14922 | .hp_nid = 0x03, |
| 14923 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14924 | .channel_mode = alc269_modes, |
| 14925 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14926 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14927 | .init_hook = alc269_laptop_inithook, |
| 14928 | }, |
| 14929 | [ALC269VB_DMIC] = { |
| 14930 | .mixers = { alc269vb_laptop_mixer }, |
| 14931 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14932 | .init_verbs = { alc269vb_init_verbs, |
| 14933 | alc269vb_laptop_dmic_init_verbs }, |
| 14934 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14935 | .dac_nids = alc269_dac_nids, |
| 14936 | .hp_nid = 0x03, |
| 14937 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14938 | .channel_mode = alc269_modes, |
| 14939 | .unsol_event = alc269_laptop_unsol_event, |
| 14940 | .setup = alc269vb_laptop_dmic_setup, |
| 14941 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14942 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14943 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14944 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14945 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14946 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14947 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14948 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14949 | .dac_nids = alc269_dac_nids, |
| 14950 | .hp_nid = 0x03, |
| 14951 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14952 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14953 | .unsol_event = alc269_laptop_unsol_event, |
| 14954 | .setup = alc269_laptop_dmic_setup, |
| 14955 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14956 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14957 | [ALC269_LIFEBOOK] = { |
| 14958 | .mixers = { alc269_lifebook_mixer }, |
| 14959 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14960 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14961 | .dac_nids = alc269_dac_nids, |
| 14962 | .hp_nid = 0x03, |
| 14963 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14964 | .channel_mode = alc269_modes, |
| 14965 | .input_mux = &alc269_capture_source, |
| 14966 | .unsol_event = alc269_lifebook_unsol_event, |
| 14967 | .init_hook = alc269_lifebook_init_hook, |
| 14968 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14969 | [ALC271_ACER] = { |
| 14970 | .mixers = { alc269_asus_mixer }, |
| 14971 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14972 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14973 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14974 | .dac_nids = alc269_dac_nids, |
| 14975 | .adc_nids = alc262_dmic_adc_nids, |
| 14976 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14977 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14978 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14979 | .channel_mode = alc269_modes, |
| 14980 | .input_mux = &alc269_capture_source, |
| 14981 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14982 | .unsol_event = alc_sku_unsol_event, |
| 14983 | .setup = alc269vb_laptop_dmic_setup, |
| 14984 | .init_hook = alc_inithook, |
| 14985 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14986 | }; |
| 14987 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14988 | static int alc269_fill_coef(struct hda_codec *codec) |
| 14989 | { |
| 14990 | int val; |
| 14991 | |
| 14992 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 14993 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14994 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 14995 | } |
| 14996 | |
| 14997 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 14998 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14999 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15000 | } |
| 15001 | |
| 15002 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15003 | val = alc_read_coef_idx(codec, 0x04); |
| 15004 | /* Power up output pin */ |
| 15005 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15006 | } |
| 15007 | |
| 15008 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15009 | val = alc_read_coef_idx(codec, 0xd); |
| 15010 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15011 | /* Capless ramp up clock control */ |
| 15012 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15013 | } |
| 15014 | val = alc_read_coef_idx(codec, 0x17); |
| 15015 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15016 | /* Class D power on reset */ |
| 15017 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15018 | } |
| 15019 | } |
| 15020 | return 0; |
| 15021 | } |
| 15022 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15023 | static int patch_alc269(struct hda_codec *codec) |
| 15024 | { |
| 15025 | struct alc_spec *spec; |
| 15026 | int board_config; |
| 15027 | int err; |
| 15028 | |
| 15029 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15030 | if (spec == NULL) |
| 15031 | return -ENOMEM; |
| 15032 | |
| 15033 | codec->spec = spec; |
| 15034 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15035 | alc_auto_parse_customize_define(codec); |
| 15036 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 15037 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15038 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15039 | spec->cdefine.platform_type == 1) { |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15040 | alc_codec_rename(codec, "ALC271X"); |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15041 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15042 | } else { |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15043 | alc_codec_rename(codec, "ALC259"); |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15044 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15045 | } |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 15046 | } else |
| 15047 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 15048 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15049 | alc269_fill_coef(codec); |
| 15050 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15051 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15052 | alc269_models, |
| 15053 | alc269_cfg_tbl); |
| 15054 | |
| 15055 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15056 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15057 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15058 | board_config = ALC269_AUTO; |
| 15059 | } |
| 15060 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15061 | if (board_config == ALC269_AUTO) |
| 15062 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 15063 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15064 | if (board_config == ALC269_AUTO) { |
| 15065 | /* automatic parse from the BIOS config */ |
| 15066 | err = alc269_parse_auto_config(codec); |
| 15067 | if (err < 0) { |
| 15068 | alc_free(codec); |
| 15069 | return err; |
| 15070 | } else if (!err) { |
| 15071 | printk(KERN_INFO |
| 15072 | "hda_codec: Cannot set up configuration " |
| 15073 | "from BIOS. Using base mode...\n"); |
| 15074 | board_config = ALC269_BASIC; |
| 15075 | } |
| 15076 | } |
| 15077 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15078 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15079 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15080 | if (err < 0) { |
| 15081 | alc_free(codec); |
| 15082 | return err; |
| 15083 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15084 | } |
| 15085 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15086 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15087 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15088 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15089 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15090 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15091 | * fix the sample rate of analog I/O to 44.1kHz |
| 15092 | */ |
| 15093 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15094 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15095 | } else if (spec->dual_adc_switch) { |
| 15096 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15097 | /* switch ADC dynamically */ |
| 15098 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15099 | } else { |
| 15100 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15101 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15102 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15103 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15104 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15105 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15106 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 15107 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15108 | spec->adc_nids = alc269_adc_nids; |
| 15109 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15110 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15111 | } else { |
| 15112 | spec->adc_nids = alc269vb_adc_nids; |
| 15113 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15114 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15115 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15116 | } |
| 15117 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15118 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15119 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15120 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15121 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15122 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15123 | if (board_config == ALC269_AUTO) |
| 15124 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 15125 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15126 | spec->vmaster_nid = 0x02; |
| 15127 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15128 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15129 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15130 | codec->patch_ops.suspend = alc269_suspend; |
| 15131 | #endif |
| 15132 | #ifdef SND_HDA_NEEDS_RESUME |
| 15133 | codec->patch_ops.resume = alc269_resume; |
| 15134 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15135 | if (board_config == ALC269_AUTO) |
| 15136 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15137 | |
| 15138 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15139 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15140 | if (!spec->loopback.amplist) |
| 15141 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15142 | if (alc269_mic2_for_mute_led(codec)) |
| 15143 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15144 | #endif |
| 15145 | |
| 15146 | return 0; |
| 15147 | } |
| 15148 | |
| 15149 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15150 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15151 | */ |
| 15152 | |
| 15153 | /* |
| 15154 | * set the path ways for 2 channel output |
| 15155 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15156 | */ |
| 15157 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15158 | /* set pin widget 1Ah (line in) for input */ |
| 15159 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15160 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15161 | * the vref |
| 15162 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15163 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15164 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15165 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15166 | #if 0 |
| 15167 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15168 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15169 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15170 | { } /* end */ |
| 15171 | }; |
| 15172 | /* |
| 15173 | * 6ch mode |
| 15174 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15175 | */ |
| 15176 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15177 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15178 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15179 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15180 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15181 | |
| 15182 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15183 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15184 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15185 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15186 | #if 0 |
| 15187 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15188 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15189 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15190 | { } /* end */ |
| 15191 | }; |
| 15192 | |
| 15193 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15194 | { 2, alc861_threestack_ch2_init }, |
| 15195 | { 6, alc861_threestack_ch6_init }, |
| 15196 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15197 | /* Set mic1 as input and unmute the mixer */ |
| 15198 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15199 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15200 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15201 | { } /* end */ |
| 15202 | }; |
| 15203 | /* Set mic1 as output and mute mixer */ |
| 15204 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15205 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15206 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15207 | { } /* end */ |
| 15208 | }; |
| 15209 | |
| 15210 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15211 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15212 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15213 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15214 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15215 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15216 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15217 | /* set pin widget 1Ah (line in) for input */ |
| 15218 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15219 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15220 | * the vref |
| 15221 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15222 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15223 | |
| 15224 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15225 | #if 0 |
| 15226 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15227 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15228 | #endif |
| 15229 | { } /* end */ |
| 15230 | }; |
| 15231 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15232 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15233 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15234 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15235 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15236 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15237 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15238 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15239 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15240 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15241 | |
| 15242 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15243 | #if 0 |
| 15244 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15245 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15246 | #endif |
| 15247 | { } /* end */ |
| 15248 | }; |
| 15249 | |
| 15250 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15251 | { 2, alc861_asus_ch2_init }, |
| 15252 | { 6, alc861_asus_ch6_init }, |
| 15253 | }; |
| 15254 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15255 | /* patch-ALC861 */ |
| 15256 | |
| 15257 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15258 | /* output mixer control */ |
| 15259 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15260 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15261 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15262 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15263 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15264 | |
| 15265 | /*Input mixer control */ |
| 15266 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15267 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15268 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15269 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15271 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15272 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15273 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15274 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15275 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15276 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15277 | { } /* end */ |
| 15278 | }; |
| 15279 | |
| 15280 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15281 | /* output mixer control */ |
| 15282 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15283 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15284 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15285 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15286 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15287 | |
| 15288 | /* Input mixer control */ |
| 15289 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15290 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15291 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15292 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15293 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15294 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15296 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15297 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15298 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15299 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15300 | { |
| 15301 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15302 | .name = "Channel Mode", |
| 15303 | .info = alc_ch_mode_info, |
| 15304 | .get = alc_ch_mode_get, |
| 15305 | .put = alc_ch_mode_put, |
| 15306 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15307 | }, |
| 15308 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15309 | }; |
| 15310 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15311 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15312 | /* output mixer control */ |
| 15313 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15316 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15317 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15318 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15319 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15320 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15321 | /* output mixer control */ |
| 15322 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15323 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15324 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15325 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15326 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15327 | |
| 15328 | /* Input mixer control */ |
| 15329 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15330 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15331 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15332 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15333 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15334 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15335 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15336 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15337 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15338 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15339 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15340 | { |
| 15341 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15342 | .name = "Channel Mode", |
| 15343 | .info = alc_ch_mode_info, |
| 15344 | .get = alc_ch_mode_get, |
| 15345 | .put = alc_ch_mode_put, |
| 15346 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15347 | }, |
| 15348 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15349 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15350 | |
| 15351 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15352 | /* output mixer control */ |
| 15353 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15354 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15355 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15356 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15357 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15358 | |
| 15359 | /* Input mixer control */ |
| 15360 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15361 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15362 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15363 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15364 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15365 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15368 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15369 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15370 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15371 | { |
| 15372 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15373 | .name = "Channel Mode", |
| 15374 | .info = alc_ch_mode_info, |
| 15375 | .get = alc_ch_mode_get, |
| 15376 | .put = alc_ch_mode_put, |
| 15377 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15378 | }, |
| 15379 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15380 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15381 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15382 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15383 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15384 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15385 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15386 | { } |
| 15387 | }; |
| 15388 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15389 | /* |
| 15390 | * generic initialization of ADC, input mixers and output mixers |
| 15391 | */ |
| 15392 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15393 | /* |
| 15394 | * Unmute ADC0 and set the default input to mic-in |
| 15395 | */ |
| 15396 | /* port-A for surround (rear panel) */ |
| 15397 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15398 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15399 | /* port-B for mic-in (rear panel) with vref */ |
| 15400 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15401 | /* port-C for line-in (rear panel) */ |
| 15402 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15403 | /* port-D for Front */ |
| 15404 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15405 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15406 | /* port-E for HP out (front panel) */ |
| 15407 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15408 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15409 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15410 | /* port-F for mic-in (front panel) with vref */ |
| 15411 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15412 | /* port-G for CLFE (rear panel) */ |
| 15413 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15414 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15415 | /* port-H for side (rear panel) */ |
| 15416 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15417 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15418 | /* CD-in */ |
| 15419 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15420 | /* route front mic to ADC1*/ |
| 15421 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15422 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15424 | /* Unmute DAC0~3 & spdif out*/ |
| 15425 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15426 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15427 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15428 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15429 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15430 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15431 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15432 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15433 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15434 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15435 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15436 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15437 | /* Unmute Stereo Mixer 15 */ |
| 15438 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15439 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15440 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15441 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15442 | |
| 15443 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15444 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15445 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15446 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15447 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15448 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15449 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15450 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15451 | /* hp used DAC 3 (Front) */ |
| 15452 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15453 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15454 | |
| 15455 | { } |
| 15456 | }; |
| 15457 | |
| 15458 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15459 | /* |
| 15460 | * Unmute ADC0 and set the default input to mic-in |
| 15461 | */ |
| 15462 | /* port-A for surround (rear panel) */ |
| 15463 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15464 | /* port-B for mic-in (rear panel) with vref */ |
| 15465 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15466 | /* port-C for line-in (rear panel) */ |
| 15467 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15468 | /* port-D for Front */ |
| 15469 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15470 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15471 | /* port-E for HP out (front panel) */ |
| 15472 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15473 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15474 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15475 | /* port-F for mic-in (front panel) with vref */ |
| 15476 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15477 | /* port-G for CLFE (rear panel) */ |
| 15478 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15479 | /* port-H for side (rear panel) */ |
| 15480 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15481 | /* CD-in */ |
| 15482 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15483 | /* route front mic to ADC1*/ |
| 15484 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15485 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15486 | /* Unmute DAC0~3 & spdif out*/ |
| 15487 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15488 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15489 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15490 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15491 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15492 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15493 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15494 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15495 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15496 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15497 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15498 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15499 | /* Unmute Stereo Mixer 15 */ |
| 15500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15501 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15502 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15503 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15504 | |
| 15505 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15506 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15507 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15508 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15509 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15510 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15511 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15512 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15513 | /* hp used DAC 3 (Front) */ |
| 15514 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15515 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15516 | { } |
| 15517 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15518 | |
| 15519 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15520 | /* |
| 15521 | * Unmute ADC0 and set the default input to mic-in |
| 15522 | */ |
| 15523 | /* port-A for surround (rear panel) */ |
| 15524 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15525 | /* port-B for mic-in (rear panel) with vref */ |
| 15526 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15527 | /* port-C for line-in (rear panel) */ |
| 15528 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15529 | /* port-D for Front */ |
| 15530 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15531 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15532 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15533 | /* this has to be set to VREF80 */ |
| 15534 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15535 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15536 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15537 | /* port-F for mic-in (front panel) with vref */ |
| 15538 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15539 | /* port-G for CLFE (rear panel) */ |
| 15540 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15541 | /* port-H for side (rear panel) */ |
| 15542 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15543 | /* CD-in */ |
| 15544 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15545 | /* route front mic to ADC1*/ |
| 15546 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15547 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15548 | /* Unmute DAC0~3 & spdif out*/ |
| 15549 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15550 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15551 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15552 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15554 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15555 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15556 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15557 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15558 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15559 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15560 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15561 | /* Unmute Stereo Mixer 15 */ |
| 15562 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15563 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15564 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15566 | |
| 15567 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15568 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15569 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15570 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15571 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15572 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15573 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15574 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15575 | /* hp used DAC 3 (Front) */ |
| 15576 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15577 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15578 | { } |
| 15579 | }; |
| 15580 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15581 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15582 | /* |
| 15583 | * Unmute ADC0 and set the default input to mic-in |
| 15584 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15585 | /* port-A for surround (rear panel) |
| 15586 | * according to codec#0 this is the HP jack |
| 15587 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15588 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15589 | /* route front PCM to HP */ |
| 15590 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15591 | /* port-B for mic-in (rear panel) with vref */ |
| 15592 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15593 | /* port-C for line-in (rear panel) */ |
| 15594 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15595 | /* port-D for Front */ |
| 15596 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15597 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15598 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15599 | /* this has to be set to VREF80 */ |
| 15600 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15601 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15602 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15603 | /* port-F for mic-in (front panel) with vref */ |
| 15604 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15605 | /* port-G for CLFE (rear panel) */ |
| 15606 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15607 | /* port-H for side (rear panel) */ |
| 15608 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15609 | /* CD-in */ |
| 15610 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15611 | /* route front mic to ADC1*/ |
| 15612 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15613 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15614 | /* Unmute DAC0~3 & spdif out*/ |
| 15615 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15616 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15617 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15618 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15619 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15620 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15621 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15622 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15623 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15624 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15625 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15626 | /* Unmute Stereo Mixer 15 */ |
| 15627 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15628 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15629 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15630 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15631 | |
| 15632 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15633 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15634 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15635 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15637 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15638 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15639 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15640 | /* hp used DAC 3 (Front) */ |
| 15641 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15642 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15643 | { } |
| 15644 | }; |
| 15645 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15646 | /* additional init verbs for ASUS laptops */ |
| 15647 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15648 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15649 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15650 | { } |
| 15651 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15652 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15653 | /* |
| 15654 | * generic initialization of ADC, input mixers and output mixers |
| 15655 | */ |
| 15656 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15657 | /* |
| 15658 | * Unmute ADC0 and set the default input to mic-in |
| 15659 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15660 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15661 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15662 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15663 | /* Unmute DAC0~3 & spdif out*/ |
| 15664 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15665 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15666 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15667 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15668 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15669 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15670 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15671 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15672 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15673 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15674 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15675 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15676 | /* Unmute Stereo Mixer 15 */ |
| 15677 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15678 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15679 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15680 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15681 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15682 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15683 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15684 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15685 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15686 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15687 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15688 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15689 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15690 | |
| 15691 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15692 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15693 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15694 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15695 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15696 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15697 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15698 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15699 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15700 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15701 | |
| 15702 | { } |
| 15703 | }; |
| 15704 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15705 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15706 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15707 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15708 | { } |
| 15709 | }; |
| 15710 | |
| 15711 | /* toggle speaker-output according to the hp-jack state */ |
| 15712 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15713 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15714 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15715 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15716 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15717 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15718 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15719 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15720 | } |
| 15721 | |
| 15722 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15723 | unsigned int res) |
| 15724 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15725 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15726 | alc861_toshiba_automute(codec); |
| 15727 | } |
| 15728 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15729 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15730 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15731 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15732 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15733 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15734 | |
| 15735 | |
| 15736 | #define ALC861_DIGOUT_NID 0x07 |
| 15737 | |
| 15738 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15739 | { 8, NULL } |
| 15740 | }; |
| 15741 | |
| 15742 | static hda_nid_t alc861_dac_nids[4] = { |
| 15743 | /* front, surround, clfe, side */ |
| 15744 | 0x03, 0x06, 0x05, 0x04 |
| 15745 | }; |
| 15746 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15747 | static hda_nid_t alc660_dac_nids[3] = { |
| 15748 | /* front, clfe, surround */ |
| 15749 | 0x03, 0x05, 0x06 |
| 15750 | }; |
| 15751 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15752 | static hda_nid_t alc861_adc_nids[1] = { |
| 15753 | /* ADC0-2 */ |
| 15754 | 0x08, |
| 15755 | }; |
| 15756 | |
| 15757 | static struct hda_input_mux alc861_capture_source = { |
| 15758 | .num_items = 5, |
| 15759 | .items = { |
| 15760 | { "Mic", 0x0 }, |
| 15761 | { "Front Mic", 0x3 }, |
| 15762 | { "Line", 0x1 }, |
| 15763 | { "CD", 0x4 }, |
| 15764 | { "Mixer", 0x5 }, |
| 15765 | }, |
| 15766 | }; |
| 15767 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15768 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15769 | { |
| 15770 | struct alc_spec *spec = codec->spec; |
| 15771 | hda_nid_t mix, srcs[5]; |
| 15772 | int i, j, num; |
| 15773 | |
| 15774 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15775 | return 0; |
| 15776 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15777 | if (num < 0) |
| 15778 | return 0; |
| 15779 | for (i = 0; i < num; i++) { |
| 15780 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15781 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15782 | if (type != AC_WID_AUD_OUT) |
| 15783 | continue; |
| 15784 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15785 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15786 | break; |
| 15787 | if (j >= spec->multiout.num_dacs) |
| 15788 | return srcs[i]; |
| 15789 | } |
| 15790 | return 0; |
| 15791 | } |
| 15792 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15793 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15794 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15795 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15796 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15797 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15798 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15799 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15800 | |
| 15801 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15802 | for (i = 0; i < cfg->line_outs; i++) { |
| 15803 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15804 | dac = alc861_look_for_dac(codec, nid); |
| 15805 | if (!dac) |
| 15806 | continue; |
| 15807 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15808 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15809 | return 0; |
| 15810 | } |
| 15811 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15812 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15813 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15814 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15815 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15816 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15817 | } |
| 15818 | |
| 15819 | /* add playback controls from the parsed DAC table */ |
| 15820 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15821 | const struct auto_pin_cfg *cfg) |
| 15822 | { |
| 15823 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15824 | static const char *chname[4] = { |
| 15825 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15826 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15827 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15828 | int i, err; |
| 15829 | |
| 15830 | if (cfg->line_outs == 1) { |
| 15831 | const char *pfx = NULL; |
| 15832 | if (!cfg->hp_outs) |
| 15833 | pfx = "Master"; |
| 15834 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15835 | pfx = "Speaker"; |
| 15836 | if (pfx) { |
| 15837 | nid = spec->multiout.dac_nids[0]; |
| 15838 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15839 | } |
| 15840 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15841 | |
| 15842 | for (i = 0; i < cfg->line_outs; i++) { |
| 15843 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15844 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15845 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15846 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15847 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15848 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15849 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15850 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15851 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15852 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15853 | return err; |
| 15854 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15855 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15856 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15857 | return err; |
| 15858 | } |
| 15859 | } |
| 15860 | return 0; |
| 15861 | } |
| 15862 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15863 | 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] | 15864 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15865 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15866 | int err; |
| 15867 | hda_nid_t nid; |
| 15868 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15869 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15870 | return 0; |
| 15871 | |
| 15872 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15873 | nid = alc861_look_for_dac(codec, pin); |
| 15874 | if (nid) { |
| 15875 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15876 | if (err < 0) |
| 15877 | return err; |
| 15878 | spec->multiout.hp_nid = nid; |
| 15879 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15880 | } |
| 15881 | return 0; |
| 15882 | } |
| 15883 | |
| 15884 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15885 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15886 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15887 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15888 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15889 | } |
| 15890 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15891 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15892 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15893 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15894 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15895 | hda_nid_t mix, srcs[5]; |
| 15896 | int i, num; |
| 15897 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15898 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15899 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15900 | 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] | 15901 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15902 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15903 | return; |
| 15904 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15905 | if (num < 0) |
| 15906 | return; |
| 15907 | for (i = 0; i < num; i++) { |
| 15908 | unsigned int mute; |
| 15909 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15910 | mute = AMP_IN_UNMUTE(i); |
| 15911 | else |
| 15912 | mute = AMP_IN_MUTE(i); |
| 15913 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15914 | mute); |
| 15915 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15916 | } |
| 15917 | |
| 15918 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15919 | { |
| 15920 | struct alc_spec *spec = codec->spec; |
| 15921 | int i; |
| 15922 | |
| 15923 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15924 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15925 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15926 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15927 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15928 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15929 | } |
| 15930 | } |
| 15931 | |
| 15932 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15933 | { |
| 15934 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15935 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15936 | if (spec->autocfg.hp_outs) |
| 15937 | alc861_auto_set_output_and_unmute(codec, |
| 15938 | spec->autocfg.hp_pins[0], |
| 15939 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15940 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15941 | if (spec->autocfg.speaker_outs) |
| 15942 | alc861_auto_set_output_and_unmute(codec, |
| 15943 | spec->autocfg.speaker_pins[0], |
| 15944 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15945 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15946 | } |
| 15947 | |
| 15948 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15949 | { |
| 15950 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15951 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15952 | int i; |
| 15953 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15954 | for (i = 0; i < cfg->num_inputs; i++) { |
| 15955 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15956 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 15957 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15958 | } |
| 15959 | } |
| 15960 | |
| 15961 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15962 | /* return 1 if successful, 0 if the proper config is not found, |
| 15963 | * or a negative error code |
| 15964 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15965 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15966 | { |
| 15967 | struct alc_spec *spec = codec->spec; |
| 15968 | int err; |
| 15969 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15970 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15971 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15972 | alc861_ignore); |
| 15973 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15974 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15975 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15976 | return 0; /* can't find valid BIOS pin config */ |
| 15977 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15978 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15979 | if (err < 0) |
| 15980 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15981 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15982 | if (err < 0) |
| 15983 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15984 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15985 | if (err < 0) |
| 15986 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15987 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15988 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15989 | return err; |
| 15990 | |
| 15991 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15992 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15993 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15994 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15995 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15996 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15997 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15998 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15999 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16000 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16001 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16002 | |
| 16003 | spec->adc_nids = alc861_adc_nids; |
| 16004 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16005 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16006 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16007 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16008 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16009 | return 1; |
| 16010 | } |
| 16011 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16012 | /* additional initialization for auto-configuration model */ |
| 16013 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16014 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16015 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16016 | alc861_auto_init_multi_out(codec); |
| 16017 | alc861_auto_init_hp_out(codec); |
| 16018 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16019 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16020 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16021 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16022 | } |
| 16023 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16024 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16025 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16026 | { 0x15, HDA_INPUT, 0 }, |
| 16027 | { 0x15, HDA_INPUT, 1 }, |
| 16028 | { 0x15, HDA_INPUT, 2 }, |
| 16029 | { 0x15, HDA_INPUT, 3 }, |
| 16030 | { } /* end */ |
| 16031 | }; |
| 16032 | #endif |
| 16033 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16034 | |
| 16035 | /* |
| 16036 | * configuration and preset |
| 16037 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16038 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 16039 | [ALC861_3ST] = "3stack", |
| 16040 | [ALC660_3ST] = "3stack-660", |
| 16041 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16042 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16043 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16044 | [ALC861_TOSHIBA] = "toshiba", |
| 16045 | [ALC861_ASUS] = "asus", |
| 16046 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16047 | [ALC861_AUTO] = "auto", |
| 16048 | }; |
| 16049 | |
| 16050 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16051 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16052 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16053 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16054 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16055 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16056 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16057 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16058 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16059 | * Any other models that need this preset? |
| 16060 | */ |
| 16061 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16062 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16063 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16064 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16065 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16066 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16067 | /* FIXME: the below seems conflict */ |
| 16068 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16069 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16070 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16071 | {} |
| 16072 | }; |
| 16073 | |
| 16074 | static struct alc_config_preset alc861_presets[] = { |
| 16075 | [ALC861_3ST] = { |
| 16076 | .mixers = { alc861_3ST_mixer }, |
| 16077 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16078 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16079 | .dac_nids = alc861_dac_nids, |
| 16080 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16081 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16082 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16083 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16084 | .adc_nids = alc861_adc_nids, |
| 16085 | .input_mux = &alc861_capture_source, |
| 16086 | }, |
| 16087 | [ALC861_3ST_DIG] = { |
| 16088 | .mixers = { alc861_base_mixer }, |
| 16089 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16090 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16091 | .dac_nids = alc861_dac_nids, |
| 16092 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16093 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16094 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16095 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16096 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16097 | .adc_nids = alc861_adc_nids, |
| 16098 | .input_mux = &alc861_capture_source, |
| 16099 | }, |
| 16100 | [ALC861_6ST_DIG] = { |
| 16101 | .mixers = { alc861_base_mixer }, |
| 16102 | .init_verbs = { alc861_base_init_verbs }, |
| 16103 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16104 | .dac_nids = alc861_dac_nids, |
| 16105 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16106 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16107 | .channel_mode = alc861_8ch_modes, |
| 16108 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16109 | .adc_nids = alc861_adc_nids, |
| 16110 | .input_mux = &alc861_capture_source, |
| 16111 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16112 | [ALC660_3ST] = { |
| 16113 | .mixers = { alc861_3ST_mixer }, |
| 16114 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16115 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16116 | .dac_nids = alc660_dac_nids, |
| 16117 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16118 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16119 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16120 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16121 | .adc_nids = alc861_adc_nids, |
| 16122 | .input_mux = &alc861_capture_source, |
| 16123 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16124 | [ALC861_UNIWILL_M31] = { |
| 16125 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16126 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16127 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16128 | .dac_nids = alc861_dac_nids, |
| 16129 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16130 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16131 | .channel_mode = alc861_uniwill_m31_modes, |
| 16132 | .need_dac_fix = 1, |
| 16133 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16134 | .adc_nids = alc861_adc_nids, |
| 16135 | .input_mux = &alc861_capture_source, |
| 16136 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16137 | [ALC861_TOSHIBA] = { |
| 16138 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16139 | .init_verbs = { alc861_base_init_verbs, |
| 16140 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16141 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16142 | .dac_nids = alc861_dac_nids, |
| 16143 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16144 | .channel_mode = alc883_3ST_2ch_modes, |
| 16145 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16146 | .adc_nids = alc861_adc_nids, |
| 16147 | .input_mux = &alc861_capture_source, |
| 16148 | .unsol_event = alc861_toshiba_unsol_event, |
| 16149 | .init_hook = alc861_toshiba_automute, |
| 16150 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16151 | [ALC861_ASUS] = { |
| 16152 | .mixers = { alc861_asus_mixer }, |
| 16153 | .init_verbs = { alc861_asus_init_verbs }, |
| 16154 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16155 | .dac_nids = alc861_dac_nids, |
| 16156 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16157 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16158 | .channel_mode = alc861_asus_modes, |
| 16159 | .need_dac_fix = 1, |
| 16160 | .hp_nid = 0x06, |
| 16161 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16162 | .adc_nids = alc861_adc_nids, |
| 16163 | .input_mux = &alc861_capture_source, |
| 16164 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16165 | [ALC861_ASUS_LAPTOP] = { |
| 16166 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16167 | .init_verbs = { alc861_asus_init_verbs, |
| 16168 | alc861_asus_laptop_init_verbs }, |
| 16169 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16170 | .dac_nids = alc861_dac_nids, |
| 16171 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16172 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16173 | .channel_mode = alc883_3ST_2ch_modes, |
| 16174 | .need_dac_fix = 1, |
| 16175 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16176 | .adc_nids = alc861_adc_nids, |
| 16177 | .input_mux = &alc861_capture_source, |
| 16178 | }, |
| 16179 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16180 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16181 | /* Pin config fixes */ |
| 16182 | enum { |
| 16183 | PINFIX_FSC_AMILO_PI1505, |
| 16184 | }; |
| 16185 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16186 | static const struct alc_fixup alc861_fixups[] = { |
| 16187 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16188 | .pins = (const struct alc_pincfg[]) { |
| 16189 | { 0x0b, 0x0221101f }, /* HP */ |
| 16190 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16191 | { } |
| 16192 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16193 | }, |
| 16194 | }; |
| 16195 | |
| 16196 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16197 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16198 | {} |
| 16199 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16200 | |
| 16201 | static int patch_alc861(struct hda_codec *codec) |
| 16202 | { |
| 16203 | struct alc_spec *spec; |
| 16204 | int board_config; |
| 16205 | int err; |
| 16206 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16207 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16208 | if (spec == NULL) |
| 16209 | return -ENOMEM; |
| 16210 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16211 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16212 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16213 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16214 | alc861_models, |
| 16215 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16216 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16217 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16218 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16219 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16220 | board_config = ALC861_AUTO; |
| 16221 | } |
| 16222 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16223 | if (board_config == ALC861_AUTO) |
| 16224 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16225 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16226 | if (board_config == ALC861_AUTO) { |
| 16227 | /* automatic parse from the BIOS config */ |
| 16228 | err = alc861_parse_auto_config(codec); |
| 16229 | if (err < 0) { |
| 16230 | alc_free(codec); |
| 16231 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16232 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16233 | printk(KERN_INFO |
| 16234 | "hda_codec: Cannot set up configuration " |
| 16235 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16236 | board_config = ALC861_3ST_DIG; |
| 16237 | } |
| 16238 | } |
| 16239 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16240 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16241 | if (err < 0) { |
| 16242 | alc_free(codec); |
| 16243 | return err; |
| 16244 | } |
| 16245 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16246 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16247 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16249 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16250 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16251 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16252 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16253 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16254 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16255 | if (!spec->cap_mixer) |
| 16256 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16257 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16258 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16259 | spec->vmaster_nid = 0x03; |
| 16260 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16261 | if (board_config == ALC861_AUTO) |
| 16262 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 16263 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16264 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16265 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16266 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16267 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16268 | spec->power_hook = alc_power_eapd; |
| 16269 | #endif |
| 16270 | } |
| 16271 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16272 | if (!spec->loopback.amplist) |
| 16273 | spec->loopback.amplist = alc861_loopbacks; |
| 16274 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16276 | return 0; |
| 16277 | } |
| 16278 | |
| 16279 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16280 | * ALC861-VD support |
| 16281 | * |
| 16282 | * Based on ALC882 |
| 16283 | * |
| 16284 | * In addition, an independent DAC |
| 16285 | */ |
| 16286 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16287 | |
| 16288 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16289 | /* front, surr, clfe, side surr */ |
| 16290 | 0x02, 0x03, 0x04, 0x05 |
| 16291 | }; |
| 16292 | |
| 16293 | /* dac_nids for ALC660vd are in a different order - according to |
| 16294 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16295 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16296 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16297 | * - and it is the same as in 861vd. |
| 16298 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16299 | */ |
| 16300 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16301 | /* front, rear, clfe, rear_surr */ |
| 16302 | 0x02, 0x04, 0x03 |
| 16303 | }; |
| 16304 | |
| 16305 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16306 | /* ADC0 */ |
| 16307 | 0x09, |
| 16308 | }; |
| 16309 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16310 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16311 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16312 | /* input MUX */ |
| 16313 | /* FIXME: should be a matrix-type input source selection */ |
| 16314 | static struct hda_input_mux alc861vd_capture_source = { |
| 16315 | .num_items = 4, |
| 16316 | .items = { |
| 16317 | { "Mic", 0x0 }, |
| 16318 | { "Front Mic", 0x1 }, |
| 16319 | { "Line", 0x2 }, |
| 16320 | { "CD", 0x4 }, |
| 16321 | }, |
| 16322 | }; |
| 16323 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16324 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16325 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16326 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16327 | { "Ext Mic", 0x0 }, |
| 16328 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16329 | }, |
| 16330 | }; |
| 16331 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16332 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16333 | .num_items = 2, |
| 16334 | .items = { |
| 16335 | { "Front Mic", 0x0 }, |
| 16336 | { "ATAPI Mic", 0x1 }, |
| 16337 | }, |
| 16338 | }; |
| 16339 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16340 | /* |
| 16341 | * 2ch mode |
| 16342 | */ |
| 16343 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16344 | { 2, NULL } |
| 16345 | }; |
| 16346 | |
| 16347 | /* |
| 16348 | * 6ch mode |
| 16349 | */ |
| 16350 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16351 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16352 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16353 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16354 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16355 | { } /* end */ |
| 16356 | }; |
| 16357 | |
| 16358 | /* |
| 16359 | * 8ch mode |
| 16360 | */ |
| 16361 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16362 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16363 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16364 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16365 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16366 | { } /* end */ |
| 16367 | }; |
| 16368 | |
| 16369 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16370 | { 6, alc861vd_6stack_ch6_init }, |
| 16371 | { 8, alc861vd_6stack_ch8_init }, |
| 16372 | }; |
| 16373 | |
| 16374 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16375 | { |
| 16376 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16377 | .name = "Channel Mode", |
| 16378 | .info = alc_ch_mode_info, |
| 16379 | .get = alc_ch_mode_get, |
| 16380 | .put = alc_ch_mode_put, |
| 16381 | }, |
| 16382 | { } /* end */ |
| 16383 | }; |
| 16384 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16385 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16386 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16387 | */ |
| 16388 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16389 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16390 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16391 | |
| 16392 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16393 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16394 | |
| 16395 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16396 | HDA_OUTPUT), |
| 16397 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16398 | HDA_OUTPUT), |
| 16399 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16400 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16401 | |
| 16402 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16403 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16404 | |
| 16405 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16406 | |
| 16407 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16408 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16409 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16410 | |
| 16411 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16412 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16413 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16414 | |
| 16415 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16416 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16417 | |
| 16418 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16419 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16420 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16421 | { } /* end */ |
| 16422 | }; |
| 16423 | |
| 16424 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16425 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16426 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16427 | |
| 16428 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16429 | |
| 16430 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16431 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16432 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16433 | |
| 16434 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16435 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16436 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16437 | |
| 16438 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16439 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16440 | |
| 16441 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16442 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16443 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16444 | { } /* end */ |
| 16445 | }; |
| 16446 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16447 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16448 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16449 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16450 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16451 | |
| 16452 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16453 | |
| 16454 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16455 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16456 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16457 | |
| 16458 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16459 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16460 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16461 | |
| 16462 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16463 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16464 | |
| 16465 | { } /* end */ |
| 16466 | }; |
| 16467 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16468 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 16469 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16470 | */ |
| 16471 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16472 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16473 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16474 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16475 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16476 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16477 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16478 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16479 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16480 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16481 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16482 | { } /* end */ |
| 16483 | }; |
| 16484 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16485 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16486 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16487 | */ |
| 16488 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16489 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16490 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16491 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16492 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16493 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16494 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16495 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16496 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16497 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16498 | { } /* end */ |
| 16499 | }; |
| 16500 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16501 | /* |
| 16502 | * generic initialization of ADC, input mixers and output mixers |
| 16503 | */ |
| 16504 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16505 | /* |
| 16506 | * Unmute ADC0 and set the default input to mic-in |
| 16507 | */ |
| 16508 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16509 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16510 | |
| 16511 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16512 | * the analog-loopback mixer widget |
| 16513 | */ |
| 16514 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16515 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16520 | |
| 16521 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16522 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16526 | |
| 16527 | /* |
| 16528 | * Set up output mixers (0x02 - 0x05) |
| 16529 | */ |
| 16530 | /* set vol=0 to output mixers */ |
| 16531 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16532 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16533 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16534 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16535 | |
| 16536 | /* set up input amps for analog loopback */ |
| 16537 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16538 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16539 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16540 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16541 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16542 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16543 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16544 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16545 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16546 | |
| 16547 | { } |
| 16548 | }; |
| 16549 | |
| 16550 | /* |
| 16551 | * 3-stack pin configuration: |
| 16552 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16553 | */ |
| 16554 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16555 | /* |
| 16556 | * Set pin mode and muting |
| 16557 | */ |
| 16558 | /* set front pin widgets 0x14 for output */ |
| 16559 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16560 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16561 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16562 | |
| 16563 | /* Mic (rear) pin: input vref at 80% */ |
| 16564 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16565 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16566 | /* Front Mic pin: input vref at 80% */ |
| 16567 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16568 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16569 | /* Line In pin: input */ |
| 16570 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16571 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16572 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16573 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16574 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16575 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16576 | /* CD pin widget for input */ |
| 16577 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16578 | |
| 16579 | { } |
| 16580 | }; |
| 16581 | |
| 16582 | /* |
| 16583 | * 6-stack pin configuration: |
| 16584 | */ |
| 16585 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16586 | /* |
| 16587 | * Set pin mode and muting |
| 16588 | */ |
| 16589 | /* set front pin widgets 0x14 for output */ |
| 16590 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16591 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16592 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16593 | |
| 16594 | /* Rear Pin: output 1 (0x0d) */ |
| 16595 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16596 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16597 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16598 | /* CLFE Pin: output 2 (0x0e) */ |
| 16599 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16600 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16601 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16602 | /* Side Pin: output 3 (0x0f) */ |
| 16603 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16604 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16605 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16606 | |
| 16607 | /* Mic (rear) pin: input vref at 80% */ |
| 16608 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16609 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16610 | /* Front Mic pin: input vref at 80% */ |
| 16611 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16612 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16613 | /* Line In pin: input */ |
| 16614 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16615 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16616 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16617 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16618 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16619 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16620 | /* CD pin widget for input */ |
| 16621 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16622 | |
| 16623 | { } |
| 16624 | }; |
| 16625 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16626 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16627 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16628 | { } |
| 16629 | }; |
| 16630 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16631 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16632 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16633 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16634 | { } |
| 16635 | }; |
| 16636 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16637 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16638 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16639 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16641 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16642 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16643 | {} |
| 16644 | }; |
| 16645 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16646 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16647 | { |
| 16648 | unsigned int present; |
| 16649 | unsigned char bits; |
| 16650 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16651 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16652 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16653 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16654 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16655 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16656 | } |
| 16657 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16658 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16659 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16660 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16661 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16662 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16663 | } |
| 16664 | |
| 16665 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16666 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16667 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16668 | alc861vd_lenovo_mic_automute(codec); |
| 16669 | } |
| 16670 | |
| 16671 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16672 | unsigned int res) |
| 16673 | { |
| 16674 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16675 | case ALC880_MIC_EVENT: |
| 16676 | alc861vd_lenovo_mic_automute(codec); |
| 16677 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16678 | default: |
| 16679 | alc_automute_amp_unsol_event(codec, res); |
| 16680 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16681 | } |
| 16682 | } |
| 16683 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16684 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16685 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16686 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16687 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16688 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16689 | |
| 16690 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16691 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16692 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16693 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16694 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16695 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16696 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16697 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16698 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16699 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16700 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16701 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16702 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16703 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16704 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16705 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16706 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16707 | |
| 16708 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16709 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16710 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16711 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16712 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16713 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16714 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16715 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16716 | |
| 16717 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16718 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16719 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16721 | |
| 16722 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16723 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16724 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16725 | |
| 16726 | { } /* end */ |
| 16727 | }; |
| 16728 | |
| 16729 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16730 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16731 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16732 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16733 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16734 | spec->autocfg.hp_pins[0] = 0x15; |
| 16735 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16736 | } |
| 16737 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16738 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16739 | #define alc861vd_loopbacks alc880_loopbacks |
| 16740 | #endif |
| 16741 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16742 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16743 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16744 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16745 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16746 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16747 | |
| 16748 | /* |
| 16749 | * configuration and preset |
| 16750 | */ |
| 16751 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16752 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16753 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16754 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16755 | [ALC861VD_3ST] = "3stack", |
| 16756 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16757 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16758 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16759 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16760 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16761 | [ALC861VD_AUTO] = "auto", |
| 16762 | }; |
| 16763 | |
| 16764 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16765 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16766 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16767 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16768 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16769 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16770 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16771 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16772 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16773 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16774 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16775 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16776 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16777 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16778 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16779 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16780 | {} |
| 16781 | }; |
| 16782 | |
| 16783 | static struct alc_config_preset alc861vd_presets[] = { |
| 16784 | [ALC660VD_3ST] = { |
| 16785 | .mixers = { alc861vd_3st_mixer }, |
| 16786 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16787 | alc861vd_3stack_init_verbs }, |
| 16788 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16789 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16790 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16791 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16792 | .input_mux = &alc861vd_capture_source, |
| 16793 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16794 | [ALC660VD_3ST_DIG] = { |
| 16795 | .mixers = { alc861vd_3st_mixer }, |
| 16796 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16797 | alc861vd_3stack_init_verbs }, |
| 16798 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16799 | .dac_nids = alc660vd_dac_nids, |
| 16800 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16801 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16802 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16803 | .input_mux = &alc861vd_capture_source, |
| 16804 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16805 | [ALC861VD_3ST] = { |
| 16806 | .mixers = { alc861vd_3st_mixer }, |
| 16807 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16808 | alc861vd_3stack_init_verbs }, |
| 16809 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16810 | .dac_nids = alc861vd_dac_nids, |
| 16811 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16812 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16813 | .input_mux = &alc861vd_capture_source, |
| 16814 | }, |
| 16815 | [ALC861VD_3ST_DIG] = { |
| 16816 | .mixers = { alc861vd_3st_mixer }, |
| 16817 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16818 | alc861vd_3stack_init_verbs }, |
| 16819 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16820 | .dac_nids = alc861vd_dac_nids, |
| 16821 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16822 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16823 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16824 | .input_mux = &alc861vd_capture_source, |
| 16825 | }, |
| 16826 | [ALC861VD_6ST_DIG] = { |
| 16827 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16828 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16829 | alc861vd_6stack_init_verbs }, |
| 16830 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16831 | .dac_nids = alc861vd_dac_nids, |
| 16832 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16833 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16834 | .channel_mode = alc861vd_6stack_modes, |
| 16835 | .input_mux = &alc861vd_capture_source, |
| 16836 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16837 | [ALC861VD_LENOVO] = { |
| 16838 | .mixers = { alc861vd_lenovo_mixer }, |
| 16839 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16840 | alc861vd_3stack_init_verbs, |
| 16841 | alc861vd_eapd_verbs, |
| 16842 | alc861vd_lenovo_unsol_verbs }, |
| 16843 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16844 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16845 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16846 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16847 | .input_mux = &alc861vd_capture_source, |
| 16848 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16849 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16850 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16851 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16852 | [ALC861VD_DALLAS] = { |
| 16853 | .mixers = { alc861vd_dallas_mixer }, |
| 16854 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16855 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16856 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16857 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16858 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16859 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16860 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16861 | .setup = alc861vd_dallas_setup, |
| 16862 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16863 | }, |
| 16864 | [ALC861VD_HP] = { |
| 16865 | .mixers = { alc861vd_hp_mixer }, |
| 16866 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16867 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16868 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16869 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16870 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16871 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16872 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16873 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16874 | .setup = alc861vd_dallas_setup, |
| 16875 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16876 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16877 | [ALC660VD_ASUS_V1S] = { |
| 16878 | .mixers = { alc861vd_lenovo_mixer }, |
| 16879 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16880 | alc861vd_3stack_init_verbs, |
| 16881 | alc861vd_eapd_verbs, |
| 16882 | alc861vd_lenovo_unsol_verbs }, |
| 16883 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16884 | .dac_nids = alc660vd_dac_nids, |
| 16885 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16886 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16887 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16888 | .input_mux = &alc861vd_capture_source, |
| 16889 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16890 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16891 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16892 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16893 | }; |
| 16894 | |
| 16895 | /* |
| 16896 | * BIOS auto configuration |
| 16897 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16898 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16899 | const struct auto_pin_cfg *cfg) |
| 16900 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16901 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16902 | } |
| 16903 | |
| 16904 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16905 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16906 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16907 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16908 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16909 | } |
| 16910 | |
| 16911 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16912 | { |
| 16913 | struct alc_spec *spec = codec->spec; |
| 16914 | int i; |
| 16915 | |
| 16916 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16917 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16918 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16919 | if (nid) |
| 16920 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16921 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16922 | } |
| 16923 | } |
| 16924 | |
| 16925 | |
| 16926 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16927 | { |
| 16928 | struct alc_spec *spec = codec->spec; |
| 16929 | hda_nid_t pin; |
| 16930 | |
| 16931 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16932 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16933 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16934 | pin = spec->autocfg.speaker_pins[0]; |
| 16935 | if (pin) |
| 16936 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16937 | } |
| 16938 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16939 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16940 | |
| 16941 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16942 | { |
| 16943 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16944 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16945 | int i; |
| 16946 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16947 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16948 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16949 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16950 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16951 | if (nid != ALC861VD_PIN_CD_NID && |
| 16952 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16953 | snd_hda_codec_write(codec, nid, 0, |
| 16954 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16955 | AMP_OUT_MUTE); |
| 16956 | } |
| 16957 | } |
| 16958 | } |
| 16959 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16960 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16961 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16962 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16963 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16964 | |
| 16965 | /* add playback controls from the parsed DAC table */ |
| 16966 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16967 | * different NIDs for mute/unmute switch and volume control */ |
| 16968 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16969 | const struct auto_pin_cfg *cfg) |
| 16970 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16971 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16972 | hda_nid_t nid_v, nid_s; |
| 16973 | int i, err; |
| 16974 | |
| 16975 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16976 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16977 | continue; |
| 16978 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16979 | alc880_dac_to_idx( |
| 16980 | spec->multiout.dac_nids[i])); |
| 16981 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16982 | alc880_dac_to_idx( |
| 16983 | spec->multiout.dac_nids[i])); |
| 16984 | |
| 16985 | if (i == 2) { |
| 16986 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16987 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16988 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16989 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16990 | HDA_OUTPUT)); |
| 16991 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16992 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16993 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16994 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16995 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16996 | HDA_OUTPUT)); |
| 16997 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16998 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16999 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17000 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17001 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17002 | HDA_INPUT)); |
| 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_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17006 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17007 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17008 | HDA_INPUT)); |
| 17009 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17010 | return err; |
| 17011 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 17012 | const char *pfx; |
| 17013 | if (cfg->line_outs == 1 && |
| 17014 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 17015 | if (!cfg->hp_pins) |
| 17016 | pfx = "Speaker"; |
| 17017 | else |
| 17018 | pfx = "PCM"; |
| 17019 | } else |
| 17020 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17021 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17022 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17023 | HDA_OUTPUT)); |
| 17024 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17025 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 17026 | if (cfg->line_outs == 1 && |
| 17027 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17028 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17029 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17030 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17031 | HDA_INPUT)); |
| 17032 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17033 | return err; |
| 17034 | } |
| 17035 | } |
| 17036 | return 0; |
| 17037 | } |
| 17038 | |
| 17039 | /* add playback controls for speaker and HP outputs */ |
| 17040 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17041 | * different NIDs for mute/unmute switch and volume control */ |
| 17042 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17043 | hda_nid_t pin, const char *pfx) |
| 17044 | { |
| 17045 | hda_nid_t nid_v, nid_s; |
| 17046 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17047 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17048 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17049 | return 0; |
| 17050 | |
| 17051 | if (alc880_is_fixed_pin(pin)) { |
| 17052 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17053 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17054 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17055 | spec->multiout.hp_nid = nid_v; |
| 17056 | else |
| 17057 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17058 | /* control HP volume/switch on the output mixer amp */ |
| 17059 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17060 | alc880_fixed_pin_idx(pin)); |
| 17061 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17062 | alc880_fixed_pin_idx(pin)); |
| 17063 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17064 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17065 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17066 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17067 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17068 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17069 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17070 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17071 | return err; |
| 17072 | } else if (alc880_is_multi_pin(pin)) { |
| 17073 | /* set manual connection */ |
| 17074 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17075 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17076 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17077 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17078 | return err; |
| 17079 | } |
| 17080 | return 0; |
| 17081 | } |
| 17082 | |
| 17083 | /* parse the BIOS configuration and set up the alc_spec |
| 17084 | * return 1 if successful, 0 if the proper config is not found, |
| 17085 | * or a negative error code |
| 17086 | * Based on ALC880 version - had to change it to override |
| 17087 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17088 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17089 | { |
| 17090 | struct alc_spec *spec = codec->spec; |
| 17091 | int err; |
| 17092 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17093 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17094 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17095 | alc861vd_ignore); |
| 17096 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17097 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17098 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17099 | return 0; /* can't find valid BIOS pin config */ |
| 17100 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17101 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17102 | if (err < 0) |
| 17103 | return err; |
| 17104 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17105 | if (err < 0) |
| 17106 | return err; |
| 17107 | err = alc861vd_auto_create_extra_out(spec, |
| 17108 | spec->autocfg.speaker_pins[0], |
| 17109 | "Speaker"); |
| 17110 | if (err < 0) |
| 17111 | return err; |
| 17112 | err = alc861vd_auto_create_extra_out(spec, |
| 17113 | spec->autocfg.hp_pins[0], |
| 17114 | "Headphone"); |
| 17115 | if (err < 0) |
| 17116 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17117 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17118 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17119 | return err; |
| 17120 | |
| 17121 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17122 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17123 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17124 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17125 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17126 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17127 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17128 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17129 | |
| 17130 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17131 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17132 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17133 | err = alc_auto_add_mic_boost(codec); |
| 17134 | if (err < 0) |
| 17135 | return err; |
| 17136 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17137 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17138 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17139 | return 1; |
| 17140 | } |
| 17141 | |
| 17142 | /* additional initialization for auto-configuration model */ |
| 17143 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17144 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17145 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17146 | alc861vd_auto_init_multi_out(codec); |
| 17147 | alc861vd_auto_init_hp_out(codec); |
| 17148 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17149 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17150 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17151 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17152 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17153 | } |
| 17154 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17155 | enum { |
| 17156 | ALC660VD_FIX_ASUS_GPIO1 |
| 17157 | }; |
| 17158 | |
| 17159 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17160 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17161 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17162 | .verbs = (const struct hda_verb[]) { |
| 17163 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17164 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17165 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17166 | { } |
| 17167 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17168 | }, |
| 17169 | }; |
| 17170 | |
| 17171 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17172 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17173 | {} |
| 17174 | }; |
| 17175 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17176 | static int patch_alc861vd(struct hda_codec *codec) |
| 17177 | { |
| 17178 | struct alc_spec *spec; |
| 17179 | int err, board_config; |
| 17180 | |
| 17181 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17182 | if (spec == NULL) |
| 17183 | return -ENOMEM; |
| 17184 | |
| 17185 | codec->spec = spec; |
| 17186 | |
| 17187 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17188 | alc861vd_models, |
| 17189 | alc861vd_cfg_tbl); |
| 17190 | |
| 17191 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17192 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17193 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17194 | board_config = ALC861VD_AUTO; |
| 17195 | } |
| 17196 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17197 | if (board_config == ALC861VD_AUTO) |
| 17198 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17199 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17200 | if (board_config == ALC861VD_AUTO) { |
| 17201 | /* automatic parse from the BIOS config */ |
| 17202 | err = alc861vd_parse_auto_config(codec); |
| 17203 | if (err < 0) { |
| 17204 | alc_free(codec); |
| 17205 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17206 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17207 | printk(KERN_INFO |
| 17208 | "hda_codec: Cannot set up configuration " |
| 17209 | "from BIOS. Using base mode...\n"); |
| 17210 | board_config = ALC861VD_3ST; |
| 17211 | } |
| 17212 | } |
| 17213 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17214 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17215 | if (err < 0) { |
| 17216 | alc_free(codec); |
| 17217 | return err; |
| 17218 | } |
| 17219 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17220 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17221 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17222 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17223 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17224 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17225 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17226 | } |
| 17227 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17228 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17229 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17230 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17231 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17232 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17233 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17234 | if (!spec->adc_nids) { |
| 17235 | spec->adc_nids = alc861vd_adc_nids; |
| 17236 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17237 | } |
| 17238 | if (!spec->capsrc_nids) |
| 17239 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17240 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17241 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17242 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17243 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17244 | spec->vmaster_nid = 0x02; |
| 17245 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17246 | if (board_config == ALC861VD_AUTO) |
| 17247 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 17248 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17249 | codec->patch_ops = alc_patch_ops; |
| 17250 | |
| 17251 | if (board_config == ALC861VD_AUTO) |
| 17252 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17253 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17254 | if (!spec->loopback.amplist) |
| 17255 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17256 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17257 | |
| 17258 | return 0; |
| 17259 | } |
| 17260 | |
| 17261 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17262 | * ALC662 support |
| 17263 | * |
| 17264 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17265 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17266 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17267 | * 6-channel independent captures. |
| 17268 | * |
| 17269 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17270 | * driver yet). |
| 17271 | */ |
| 17272 | #define ALC662_DIGOUT_NID 0x06 |
| 17273 | #define ALC662_DIGIN_NID 0x0a |
| 17274 | |
| 17275 | static hda_nid_t alc662_dac_nids[4] = { |
| 17276 | /* front, rear, clfe, rear_surr */ |
| 17277 | 0x02, 0x03, 0x04 |
| 17278 | }; |
| 17279 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17280 | static hda_nid_t alc272_dac_nids[2] = { |
| 17281 | 0x02, 0x03 |
| 17282 | }; |
| 17283 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17284 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17285 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17286 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17287 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17288 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17289 | static hda_nid_t alc272_adc_nids[1] = { |
| 17290 | /* ADC1-2 */ |
| 17291 | 0x08, |
| 17292 | }; |
| 17293 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17294 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17295 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17296 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17297 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17298 | /* input MUX */ |
| 17299 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17300 | static struct hda_input_mux alc662_capture_source = { |
| 17301 | .num_items = 4, |
| 17302 | .items = { |
| 17303 | { "Mic", 0x0 }, |
| 17304 | { "Front Mic", 0x1 }, |
| 17305 | { "Line", 0x2 }, |
| 17306 | { "CD", 0x4 }, |
| 17307 | }, |
| 17308 | }; |
| 17309 | |
| 17310 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17311 | .num_items = 2, |
| 17312 | .items = { |
| 17313 | { "Mic", 0x1 }, |
| 17314 | { "Line", 0x2 }, |
| 17315 | }, |
| 17316 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17317 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17318 | static struct hda_input_mux alc663_capture_source = { |
| 17319 | .num_items = 3, |
| 17320 | .items = { |
| 17321 | { "Mic", 0x0 }, |
| 17322 | { "Front Mic", 0x1 }, |
| 17323 | { "Line", 0x2 }, |
| 17324 | }, |
| 17325 | }; |
| 17326 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17327 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17328 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17329 | .num_items = 16, |
| 17330 | .items = { |
| 17331 | { "Autoselect Mic", 0x0 }, |
| 17332 | { "Internal Mic", 0x1 }, |
| 17333 | { "In-0x02", 0x2 }, |
| 17334 | { "In-0x03", 0x3 }, |
| 17335 | { "In-0x04", 0x4 }, |
| 17336 | { "In-0x05", 0x5 }, |
| 17337 | { "In-0x06", 0x6 }, |
| 17338 | { "In-0x07", 0x7 }, |
| 17339 | { "In-0x08", 0x8 }, |
| 17340 | { "In-0x09", 0x9 }, |
| 17341 | { "In-0x0a", 0x0a }, |
| 17342 | { "In-0x0b", 0x0b }, |
| 17343 | { "In-0x0c", 0x0c }, |
| 17344 | { "In-0x0d", 0x0d }, |
| 17345 | { "In-0x0e", 0x0e }, |
| 17346 | { "In-0x0f", 0x0f }, |
| 17347 | }, |
| 17348 | }; |
| 17349 | #endif |
| 17350 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17351 | /* |
| 17352 | * 2ch mode |
| 17353 | */ |
| 17354 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17355 | { 2, NULL } |
| 17356 | }; |
| 17357 | |
| 17358 | /* |
| 17359 | * 2ch mode |
| 17360 | */ |
| 17361 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17362 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17363 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17364 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17365 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17366 | { } /* end */ |
| 17367 | }; |
| 17368 | |
| 17369 | /* |
| 17370 | * 6ch mode |
| 17371 | */ |
| 17372 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17373 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17374 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17375 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17376 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17377 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17378 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17379 | { } /* end */ |
| 17380 | }; |
| 17381 | |
| 17382 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17383 | { 2, alc662_3ST_ch2_init }, |
| 17384 | { 6, alc662_3ST_ch6_init }, |
| 17385 | }; |
| 17386 | |
| 17387 | /* |
| 17388 | * 2ch mode |
| 17389 | */ |
| 17390 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17391 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17392 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17393 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17394 | { } /* end */ |
| 17395 | }; |
| 17396 | |
| 17397 | /* |
| 17398 | * 6ch mode |
| 17399 | */ |
| 17400 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17401 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17402 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17403 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17404 | { } /* end */ |
| 17405 | }; |
| 17406 | |
| 17407 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17408 | { 2, alc662_sixstack_ch6_init }, |
| 17409 | { 6, alc662_sixstack_ch8_init }, |
| 17410 | }; |
| 17411 | |
| 17412 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17413 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17414 | */ |
| 17415 | |
| 17416 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17417 | /* output mixer control */ |
| 17418 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17419 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17420 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17421 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17422 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17423 | 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] | 17424 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17425 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17426 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17427 | |
| 17428 | /*Input mixer control */ |
| 17429 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17430 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17431 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17432 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17434 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17435 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17436 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17437 | { } /* end */ |
| 17438 | }; |
| 17439 | |
| 17440 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17441 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17442 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17443 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17444 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17445 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17446 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17447 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17448 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17449 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17450 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17451 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17452 | { } /* end */ |
| 17453 | }; |
| 17454 | |
| 17455 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17456 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17457 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17458 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17459 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17460 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17461 | 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] | 17462 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17463 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17464 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17465 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17466 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17467 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17468 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17469 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17470 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17471 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17472 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17473 | { } /* end */ |
| 17474 | }; |
| 17475 | |
| 17476 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17477 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17478 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17479 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17480 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17481 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17482 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17483 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17486 | { } /* end */ |
| 17487 | }; |
| 17488 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17489 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17490 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17491 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17492 | |
| 17493 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17494 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17495 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17496 | |
| 17497 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17498 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17499 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17500 | { } /* end */ |
| 17501 | }; |
| 17502 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17503 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17504 | ALC262_HIPPO_MASTER_SWITCH, |
| 17505 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17506 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17507 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17508 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17509 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17510 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17511 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17512 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17513 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17514 | { } /* end */ |
| 17515 | }; |
| 17516 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17517 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17518 | .ops = &snd_hda_bind_vol, |
| 17519 | .values = { |
| 17520 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17521 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17522 | 0 |
| 17523 | }, |
| 17524 | }; |
| 17525 | |
| 17526 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17527 | .ops = &snd_hda_bind_sw, |
| 17528 | .values = { |
| 17529 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17530 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17531 | 0 |
| 17532 | }, |
| 17533 | }; |
| 17534 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17535 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17536 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17537 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17538 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17539 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17540 | { } /* end */ |
| 17541 | }; |
| 17542 | |
| 17543 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17544 | .ops = &snd_hda_bind_sw, |
| 17545 | .values = { |
| 17546 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17547 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17548 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17549 | 0 |
| 17550 | }, |
| 17551 | }; |
| 17552 | |
| 17553 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17554 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17555 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17556 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17557 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17558 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17559 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17560 | |
| 17561 | { } /* end */ |
| 17562 | }; |
| 17563 | |
| 17564 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17565 | .ops = &snd_hda_bind_sw, |
| 17566 | .values = { |
| 17567 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17568 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17569 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17570 | 0 |
| 17571 | }, |
| 17572 | }; |
| 17573 | |
| 17574 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17575 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17576 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17577 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17578 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17579 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17580 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17581 | { } /* end */ |
| 17582 | }; |
| 17583 | |
| 17584 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17585 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17586 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17587 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17588 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17589 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17590 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17591 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17592 | { } /* end */ |
| 17593 | }; |
| 17594 | |
| 17595 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17596 | .ops = &snd_hda_bind_vol, |
| 17597 | .values = { |
| 17598 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17599 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17600 | 0 |
| 17601 | }, |
| 17602 | }; |
| 17603 | |
| 17604 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17605 | .ops = &snd_hda_bind_sw, |
| 17606 | .values = { |
| 17607 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17608 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17609 | 0 |
| 17610 | }, |
| 17611 | }; |
| 17612 | |
| 17613 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17614 | HDA_BIND_VOL("Master Playback Volume", |
| 17615 | &alc663_asus_two_bind_master_vol), |
| 17616 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17617 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17619 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17621 | { } /* end */ |
| 17622 | }; |
| 17623 | |
| 17624 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17625 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17626 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17627 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17628 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17629 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17630 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17631 | { } /* end */ |
| 17632 | }; |
| 17633 | |
| 17634 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17635 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17636 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17638 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17640 | |
| 17641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17643 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17644 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17645 | { } /* end */ |
| 17646 | }; |
| 17647 | |
| 17648 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17649 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17650 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 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 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17658 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17659 | { } /* end */ |
| 17660 | }; |
| 17661 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17662 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17663 | .ops = &snd_hda_bind_sw, |
| 17664 | .values = { |
| 17665 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17666 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17667 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17668 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17669 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17670 | 0 |
| 17671 | }, |
| 17672 | }; |
| 17673 | |
| 17674 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_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(0x17, 3, 0, HDA_OUTPUT), |
| 17679 | 0 |
| 17680 | }, |
| 17681 | }; |
| 17682 | |
| 17683 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17684 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17685 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17686 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17687 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17688 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17689 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17690 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17693 | { } /* end */ |
| 17694 | }; |
| 17695 | |
| 17696 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17697 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17698 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17699 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17700 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17701 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17702 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17703 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17704 | { } /* end */ |
| 17705 | }; |
| 17706 | |
| 17707 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17708 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17709 | { |
| 17710 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17711 | .name = "Channel Mode", |
| 17712 | .info = alc_ch_mode_info, |
| 17713 | .get = alc_ch_mode_get, |
| 17714 | .put = alc_ch_mode_put, |
| 17715 | }, |
| 17716 | { } /* end */ |
| 17717 | }; |
| 17718 | |
| 17719 | static struct hda_verb alc662_init_verbs[] = { |
| 17720 | /* ADC: mute amp left and right */ |
| 17721 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17722 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17723 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17726 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17727 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17728 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17729 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17730 | |
| 17731 | /* Front Pin: output 0 (0x0c) */ |
| 17732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17733 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17734 | |
| 17735 | /* Rear Pin: output 1 (0x0d) */ |
| 17736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17738 | |
| 17739 | /* CLFE Pin: output 2 (0x0e) */ |
| 17740 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17741 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17742 | |
| 17743 | /* Mic (rear) pin: input vref at 80% */ |
| 17744 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17745 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17746 | /* Front Mic pin: input vref at 80% */ |
| 17747 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17748 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17749 | /* Line In pin: input */ |
| 17750 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17751 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17752 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17753 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17754 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17755 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17756 | /* CD pin widget for input */ |
| 17757 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17758 | |
| 17759 | /* FIXME: use matrix-type input source selection */ |
| 17760 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17761 | /* Input mixer */ |
| 17762 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17763 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17764 | |
| 17765 | /* always trun on EAPD */ |
| 17766 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17767 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17768 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17769 | { } |
| 17770 | }; |
| 17771 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17772 | static struct hda_verb alc663_init_verbs[] = { |
| 17773 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17774 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17775 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17776 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17777 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17778 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17779 | { } |
| 17780 | }; |
| 17781 | |
| 17782 | static struct hda_verb alc272_init_verbs[] = { |
| 17783 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17784 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 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 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17794 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17795 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17796 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17797 | {} |
| 17798 | }; |
| 17799 | |
| 17800 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17801 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17802 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17803 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17804 | }; |
| 17805 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17806 | /* Set Unsolicited Event*/ |
| 17807 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17808 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17809 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17810 | {} |
| 17811 | }; |
| 17812 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17813 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17815 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17816 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17817 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17818 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17820 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17821 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17822 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17823 | {} |
| 17824 | }; |
| 17825 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17826 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17827 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17828 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17829 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17830 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17831 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17832 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17833 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17834 | {} |
| 17835 | }; |
| 17836 | |
| 17837 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17838 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17839 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17840 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17841 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* 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 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17846 | {} |
| 17847 | }; |
| 17848 | |
| 17849 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17850 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17851 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17852 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17853 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17854 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17855 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17856 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17857 | {} |
| 17858 | }; |
| 17859 | |
| 17860 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17861 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17862 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17863 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17864 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17865 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17866 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17867 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17869 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17870 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17871 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17872 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17873 | {} |
| 17874 | }; |
| 17875 | |
| 17876 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17877 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17878 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17879 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17880 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17881 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17882 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17883 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17884 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17885 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17886 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17887 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17888 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17889 | {} |
| 17890 | }; |
| 17891 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17892 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 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 | |
| 17897 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17898 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17899 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17900 | |
| 17901 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17902 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17903 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17904 | {} |
| 17905 | }; |
| 17906 | |
| 17907 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17908 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17909 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17910 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17911 | |
| 17912 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17913 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17914 | {} |
| 17915 | }; |
| 17916 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17917 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17918 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17919 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17920 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17921 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17922 | {} |
| 17923 | }; |
| 17924 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17925 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17926 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17927 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17929 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17930 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17931 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17932 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17934 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17935 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17936 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17937 | {} |
| 17938 | }; |
| 17939 | |
| 17940 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17941 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17942 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17943 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17944 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17945 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17946 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17947 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17948 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17949 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17950 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17951 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17952 | {} |
| 17953 | }; |
| 17954 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17955 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17957 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17958 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17959 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17960 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17961 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17962 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17963 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17964 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17965 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17968 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17969 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17970 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17971 | {} |
| 17972 | }; |
| 17973 | |
| 17974 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17975 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17976 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17977 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17978 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17979 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17980 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17981 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17983 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17984 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17985 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17986 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17988 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17989 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17990 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17991 | {} |
| 17992 | }; |
| 17993 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17994 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17995 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17996 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17997 | { } /* end */ |
| 17998 | }; |
| 17999 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18000 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18001 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18002 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18003 | { } /* end */ |
| 18004 | }; |
| 18005 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18006 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18007 | { |
| 18008 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18009 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18010 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18011 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18012 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18013 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18014 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18015 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18016 | } |
| 18017 | |
| 18018 | static void alc662_lenovo_101e_all_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, 0x1b); |
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); |
| 18028 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18029 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18030 | } |
| 18031 | |
| 18032 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18033 | unsigned int res) |
| 18034 | { |
| 18035 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18036 | alc662_lenovo_101e_all_automute(codec); |
| 18037 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18038 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18039 | } |
| 18040 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18041 | /* unsolicited event for HP jack sensing */ |
| 18042 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18043 | unsigned int res) |
| 18044 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18045 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18046 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18047 | else |
| 18048 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18049 | } |
| 18050 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18051 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18052 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18053 | struct alc_spec *spec = codec->spec; |
| 18054 | |
| 18055 | alc262_hippo1_setup(codec); |
| 18056 | spec->ext_mic.pin = 0x18; |
| 18057 | spec->ext_mic.mux_idx = 0; |
| 18058 | spec->int_mic.pin = 0x19; |
| 18059 | spec->int_mic.mux_idx = 1; |
| 18060 | spec->auto_mic = 1; |
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_inithook(struct hda_codec *codec) |
| 18064 | { |
| 18065 | alc262_hippo_automute(codec); |
| 18066 | alc_mic_automute(codec); |
| 18067 | } |
| 18068 | |
| 18069 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18070 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18071 | struct alc_spec *spec = codec->spec; |
| 18072 | |
| 18073 | spec->autocfg.hp_pins[0] = 0x14; |
| 18074 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18075 | } |
| 18076 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18077 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18078 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18079 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18080 | { |
| 18081 | unsigned int present; |
| 18082 | unsigned char bits; |
| 18083 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18084 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18085 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18086 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18087 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18088 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18089 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18090 | } |
| 18091 | |
| 18092 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18093 | { |
| 18094 | unsigned int present; |
| 18095 | unsigned char bits; |
| 18096 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18097 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18098 | bits = present ? HDA_AMP_MUTE : 0; |
| 18099 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18100 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18101 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18102 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18103 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18104 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18105 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18106 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18107 | } |
| 18108 | |
| 18109 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18110 | { |
| 18111 | unsigned int present; |
| 18112 | unsigned char bits; |
| 18113 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18114 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18115 | bits = present ? HDA_AMP_MUTE : 0; |
| 18116 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18117 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18118 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18119 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18120 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18121 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18122 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18123 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18124 | } |
| 18125 | |
| 18126 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18127 | { |
| 18128 | unsigned int present; |
| 18129 | unsigned char bits; |
| 18130 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18131 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18132 | bits = present ? 0 : PIN_OUT; |
| 18133 | snd_hda_codec_write(codec, 0x14, 0, |
| 18134 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18135 | } |
| 18136 | |
| 18137 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18138 | { |
| 18139 | unsigned int present1, present2; |
| 18140 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18141 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18142 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18143 | |
| 18144 | if (present1 || present2) { |
| 18145 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18146 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18147 | } else { |
| 18148 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18149 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18150 | } |
| 18151 | } |
| 18152 | |
| 18153 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18154 | { |
| 18155 | unsigned int present1, present2; |
| 18156 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18157 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18158 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18159 | |
| 18160 | if (present1 || present2) { |
| 18161 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18162 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18163 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18164 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18165 | } else { |
| 18166 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18167 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18168 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18169 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18170 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18171 | } |
| 18172 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18173 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18174 | { |
| 18175 | unsigned int present1, present2; |
| 18176 | |
| 18177 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18178 | AC_VERB_GET_PIN_SENSE, 0) |
| 18179 | & AC_PINSENSE_PRESENCE; |
| 18180 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18181 | AC_VERB_GET_PIN_SENSE, 0) |
| 18182 | & AC_PINSENSE_PRESENCE; |
| 18183 | |
| 18184 | if (present1 || present2) { |
| 18185 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18186 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18187 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18188 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18189 | } else { |
| 18190 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18191 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18192 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18193 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18194 | } |
| 18195 | } |
| 18196 | |
| 18197 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18198 | { |
| 18199 | unsigned int present1, present2; |
| 18200 | |
| 18201 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18202 | AC_VERB_GET_PIN_SENSE, 0) |
| 18203 | & AC_PINSENSE_PRESENCE; |
| 18204 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18205 | AC_VERB_GET_PIN_SENSE, 0) |
| 18206 | & AC_PINSENSE_PRESENCE; |
| 18207 | |
| 18208 | if (present1 || present2) { |
| 18209 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18210 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18211 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18212 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18213 | } else { |
| 18214 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18215 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18216 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18217 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18218 | } |
| 18219 | } |
| 18220 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18221 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18222 | unsigned int res) |
| 18223 | { |
| 18224 | switch (res >> 26) { |
| 18225 | case ALC880_HP_EVENT: |
| 18226 | alc663_m51va_speaker_automute(codec); |
| 18227 | break; |
| 18228 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18229 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18230 | break; |
| 18231 | } |
| 18232 | } |
| 18233 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18234 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18235 | { |
| 18236 | struct alc_spec *spec = codec->spec; |
| 18237 | spec->ext_mic.pin = 0x18; |
| 18238 | spec->ext_mic.mux_idx = 0; |
| 18239 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18240 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18241 | spec->auto_mic = 1; |
| 18242 | } |
| 18243 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18244 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18245 | { |
| 18246 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18247 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18248 | } |
| 18249 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18250 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18251 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18252 | |
| 18253 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18254 | { |
| 18255 | struct alc_spec *spec = codec->spec; |
| 18256 | spec->ext_mic.pin = 0x18; |
| 18257 | spec->ext_mic.mux_idx = 0; |
| 18258 | spec->int_mic.pin = 0x19; |
| 18259 | spec->int_mic.mux_idx = 1; |
| 18260 | spec->auto_mic = 1; |
| 18261 | } |
| 18262 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18263 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18264 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18265 | /* ***************** Mode2 ******************************/ |
| 18266 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18267 | unsigned int res) |
| 18268 | { |
| 18269 | switch (res >> 26) { |
| 18270 | case ALC880_HP_EVENT: |
| 18271 | alc662_f5z_speaker_automute(codec); |
| 18272 | break; |
| 18273 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18274 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18275 | break; |
| 18276 | } |
| 18277 | } |
| 18278 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18279 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18280 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18281 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18282 | { |
| 18283 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18284 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18285 | } |
| 18286 | /* ***************** Mode3 ******************************/ |
| 18287 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18288 | unsigned int res) |
| 18289 | { |
| 18290 | switch (res >> 26) { |
| 18291 | case ALC880_HP_EVENT: |
| 18292 | alc663_two_hp_m1_speaker_automute(codec); |
| 18293 | break; |
| 18294 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18295 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18296 | break; |
| 18297 | } |
| 18298 | } |
| 18299 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18300 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18301 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18302 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18303 | { |
| 18304 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18305 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18306 | } |
| 18307 | /* ***************** Mode4 ******************************/ |
| 18308 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18309 | unsigned int res) |
| 18310 | { |
| 18311 | switch (res >> 26) { |
| 18312 | case ALC880_HP_EVENT: |
| 18313 | alc663_21jd_two_speaker_automute(codec); |
| 18314 | break; |
| 18315 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18316 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18317 | break; |
| 18318 | } |
| 18319 | } |
| 18320 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18321 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18322 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18323 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18324 | { |
| 18325 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18326 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18327 | } |
| 18328 | /* ***************** Mode5 ******************************/ |
| 18329 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18330 | unsigned int res) |
| 18331 | { |
| 18332 | switch (res >> 26) { |
| 18333 | case ALC880_HP_EVENT: |
| 18334 | alc663_15jd_two_speaker_automute(codec); |
| 18335 | break; |
| 18336 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18337 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18338 | break; |
| 18339 | } |
| 18340 | } |
| 18341 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18342 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18343 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18344 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18345 | { |
| 18346 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18347 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18348 | } |
| 18349 | /* ***************** Mode6 ******************************/ |
| 18350 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18351 | unsigned int res) |
| 18352 | { |
| 18353 | switch (res >> 26) { |
| 18354 | case ALC880_HP_EVENT: |
| 18355 | alc663_two_hp_m2_speaker_automute(codec); |
| 18356 | break; |
| 18357 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18358 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18359 | break; |
| 18360 | } |
| 18361 | } |
| 18362 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18363 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18364 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18365 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18366 | { |
| 18367 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18368 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18369 | } |
| 18370 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18371 | /* ***************** Mode7 ******************************/ |
| 18372 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18373 | unsigned int res) |
| 18374 | { |
| 18375 | switch (res >> 26) { |
| 18376 | case ALC880_HP_EVENT: |
| 18377 | alc663_two_hp_m7_speaker_automute(codec); |
| 18378 | break; |
| 18379 | case ALC880_MIC_EVENT: |
| 18380 | alc_mic_automute(codec); |
| 18381 | break; |
| 18382 | } |
| 18383 | } |
| 18384 | |
| 18385 | #define alc663_mode7_setup alc663_mode1_setup |
| 18386 | |
| 18387 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18388 | { |
| 18389 | alc663_two_hp_m7_speaker_automute(codec); |
| 18390 | alc_mic_automute(codec); |
| 18391 | } |
| 18392 | |
| 18393 | /* ***************** Mode8 ******************************/ |
| 18394 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18395 | unsigned int res) |
| 18396 | { |
| 18397 | switch (res >> 26) { |
| 18398 | case ALC880_HP_EVENT: |
| 18399 | alc663_two_hp_m8_speaker_automute(codec); |
| 18400 | break; |
| 18401 | case ALC880_MIC_EVENT: |
| 18402 | alc_mic_automute(codec); |
| 18403 | break; |
| 18404 | } |
| 18405 | } |
| 18406 | |
| 18407 | #define alc663_mode8_setup alc663_m51va_setup |
| 18408 | |
| 18409 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18410 | { |
| 18411 | alc663_two_hp_m8_speaker_automute(codec); |
| 18412 | alc_mic_automute(codec); |
| 18413 | } |
| 18414 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18415 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18416 | { |
| 18417 | unsigned int present; |
| 18418 | unsigned char bits; |
| 18419 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18420 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18421 | bits = present ? HDA_AMP_MUTE : 0; |
| 18422 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18423 | HDA_AMP_MUTE, bits); |
| 18424 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18425 | HDA_AMP_MUTE, bits); |
| 18426 | } |
| 18427 | |
| 18428 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18429 | { |
| 18430 | unsigned int present; |
| 18431 | unsigned char bits; |
| 18432 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18433 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18434 | bits = present ? HDA_AMP_MUTE : 0; |
| 18435 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18436 | HDA_AMP_MUTE, bits); |
| 18437 | } |
| 18438 | |
| 18439 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18440 | unsigned int res) |
| 18441 | { |
| 18442 | switch (res >> 26) { |
| 18443 | case ALC880_HP_EVENT: |
| 18444 | alc663_g71v_hp_automute(codec); |
| 18445 | break; |
| 18446 | case ALC880_FRONT_EVENT: |
| 18447 | alc663_g71v_front_automute(codec); |
| 18448 | break; |
| 18449 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18450 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18451 | break; |
| 18452 | } |
| 18453 | } |
| 18454 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18455 | #define alc663_g71v_setup alc663_m51va_setup |
| 18456 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18457 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18458 | { |
| 18459 | alc663_g71v_front_automute(codec); |
| 18460 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18461 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18462 | } |
| 18463 | |
| 18464 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18465 | unsigned int res) |
| 18466 | { |
| 18467 | switch (res >> 26) { |
| 18468 | case ALC880_HP_EVENT: |
| 18469 | alc663_m51va_speaker_automute(codec); |
| 18470 | break; |
| 18471 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18472 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18473 | break; |
| 18474 | } |
| 18475 | } |
| 18476 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18477 | #define alc663_g50v_setup alc663_m51va_setup |
| 18478 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18479 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18480 | { |
| 18481 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18482 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18483 | } |
| 18484 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18485 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18486 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18487 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18488 | |
| 18489 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18490 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18491 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18492 | |
| 18493 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18494 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18495 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18496 | { } /* end */ |
| 18497 | }; |
| 18498 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18499 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18500 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18501 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18502 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18503 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18504 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18505 | |
| 18506 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18507 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18508 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18509 | |
| 18510 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18511 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18512 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18513 | { } /* end */ |
| 18514 | }; |
| 18515 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18516 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18517 | #define alc662_loopbacks alc880_loopbacks |
| 18518 | #endif |
| 18519 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18520 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18521 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18522 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18523 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18524 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18525 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18526 | |
| 18527 | /* |
| 18528 | * configuration and preset |
| 18529 | */ |
| 18530 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18531 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18532 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18533 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18534 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18535 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18536 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18537 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18538 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18539 | [ALC663_ASUS_M51VA] = "m51va", |
| 18540 | [ALC663_ASUS_G71V] = "g71v", |
| 18541 | [ALC663_ASUS_H13] = "h13", |
| 18542 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18543 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18544 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18545 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18546 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18547 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18548 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18549 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18550 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18551 | [ALC272_DELL] = "dell", |
| 18552 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18553 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18554 | [ALC662_AUTO] = "auto", |
| 18555 | }; |
| 18556 | |
| 18557 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18558 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18559 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18560 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18561 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18562 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18563 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18564 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18565 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18566 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18567 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18568 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18569 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18570 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18571 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18572 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18573 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18574 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18575 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18576 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18577 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18578 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18579 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18580 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18581 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18582 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18583 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18584 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18585 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18586 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18587 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18588 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18589 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18590 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18591 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18592 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18593 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18594 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18595 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18596 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18597 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18598 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18599 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18600 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18601 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18602 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18603 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18604 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18605 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18606 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18607 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18608 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18609 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18610 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18611 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18612 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18613 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18614 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18615 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18616 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18617 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18618 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18619 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18620 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18621 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18622 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18623 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18624 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18625 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18626 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18627 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18628 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18629 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18630 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18631 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18632 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18633 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18634 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18635 | {} |
| 18636 | }; |
| 18637 | |
| 18638 | static struct alc_config_preset alc662_presets[] = { |
| 18639 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18640 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18641 | .init_verbs = { alc662_init_verbs }, |
| 18642 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18643 | .dac_nids = alc662_dac_nids, |
| 18644 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18645 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18646 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18647 | .channel_mode = alc662_3ST_2ch_modes, |
| 18648 | .input_mux = &alc662_capture_source, |
| 18649 | }, |
| 18650 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18651 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18652 | .init_verbs = { alc662_init_verbs }, |
| 18653 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18654 | .dac_nids = alc662_dac_nids, |
| 18655 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18656 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18657 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18658 | .channel_mode = alc662_3ST_6ch_modes, |
| 18659 | .need_dac_fix = 1, |
| 18660 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18661 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18662 | [ALC662_3ST_6ch] = { |
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, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18667 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18668 | .channel_mode = alc662_3ST_6ch_modes, |
| 18669 | .need_dac_fix = 1, |
| 18670 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18671 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18672 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18673 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18674 | .init_verbs = { alc662_init_verbs }, |
| 18675 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18676 | .dac_nids = alc662_dac_nids, |
| 18677 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18678 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18679 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18680 | .channel_mode = alc662_5stack_modes, |
| 18681 | .input_mux = &alc662_capture_source, |
| 18682 | }, |
| 18683 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18684 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18685 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18686 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18687 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18688 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18689 | .channel_mode = alc662_3ST_2ch_modes, |
| 18690 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18691 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18692 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18693 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18694 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18695 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18696 | .init_verbs = { alc662_init_verbs, |
| 18697 | alc662_eeepc_sue_init_verbs }, |
| 18698 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18699 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18700 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18701 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18702 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18703 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18704 | .init_hook = alc662_eeepc_inithook, |
| 18705 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18706 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18707 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18708 | alc662_chmode_mixer }, |
| 18709 | .init_verbs = { alc662_init_verbs, |
| 18710 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18711 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18712 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18713 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18714 | .channel_mode = alc662_3ST_6ch_modes, |
| 18715 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18716 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18717 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18718 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18719 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18720 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18721 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18722 | .init_verbs = { alc662_init_verbs, |
| 18723 | alc662_ecs_init_verbs }, |
| 18724 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18725 | .dac_nids = alc662_dac_nids, |
| 18726 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18727 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +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_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18730 | .init_hook = alc662_eeepc_inithook, |
| 18731 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18732 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18733 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18734 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18735 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18736 | .dac_nids = alc662_dac_nids, |
| 18737 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18738 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18739 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18740 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18741 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18742 | .init_hook = alc663_m51va_inithook, |
| 18743 | }, |
| 18744 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18745 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18746 | .init_verbs = { alc662_init_verbs, alc663_g71v_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_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18753 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18754 | .init_hook = alc663_g71v_inithook, |
| 18755 | }, |
| 18756 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18757 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18758 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18759 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18760 | .dac_nids = alc662_dac_nids, |
| 18761 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18762 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18763 | .unsol_event = alc663_m51va_unsol_event, |
| 18764 | .init_hook = alc663_m51va_inithook, |
| 18765 | }, |
| 18766 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18767 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18768 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18769 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18770 | .dac_nids = alc662_dac_nids, |
| 18771 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18772 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18773 | .channel_mode = alc662_3ST_6ch_modes, |
| 18774 | .input_mux = &alc663_capture_source, |
| 18775 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18776 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18777 | .init_hook = alc663_g50v_inithook, |
| 18778 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18779 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18780 | .mixers = { alc663_m51va_mixer }, |
| 18781 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18782 | .init_verbs = { alc662_init_verbs, |
| 18783 | alc663_21jd_amic_init_verbs }, |
| 18784 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18785 | .hp_nid = 0x03, |
| 18786 | .dac_nids = alc662_dac_nids, |
| 18787 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18788 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18789 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18790 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18791 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18792 | .init_hook = alc663_mode1_inithook, |
| 18793 | }, |
| 18794 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18795 | .mixers = { alc662_1bjd_mixer }, |
| 18796 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18797 | .init_verbs = { alc662_init_verbs, |
| 18798 | alc662_1bjd_amic_init_verbs }, |
| 18799 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18800 | .dac_nids = alc662_dac_nids, |
| 18801 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18802 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18803 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18804 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18805 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18806 | .init_hook = alc662_mode2_inithook, |
| 18807 | }, |
| 18808 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18809 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18810 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18811 | .init_verbs = { alc662_init_verbs, |
| 18812 | alc663_two_hp_amic_m1_init_verbs }, |
| 18813 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18814 | .hp_nid = 0x03, |
| 18815 | .dac_nids = alc662_dac_nids, |
| 18816 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18817 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18818 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18819 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18820 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18821 | .init_hook = alc663_mode3_inithook, |
| 18822 | }, |
| 18823 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18824 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18825 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18826 | .init_verbs = { alc662_init_verbs, |
| 18827 | alc663_21jd_amic_init_verbs}, |
| 18828 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18829 | .hp_nid = 0x03, |
| 18830 | .dac_nids = alc662_dac_nids, |
| 18831 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18832 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18833 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18834 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18835 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18836 | .init_hook = alc663_mode4_inithook, |
| 18837 | }, |
| 18838 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18839 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18840 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18841 | .init_verbs = { alc662_init_verbs, |
| 18842 | alc663_15jd_amic_init_verbs }, |
| 18843 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18844 | .hp_nid = 0x03, |
| 18845 | .dac_nids = alc662_dac_nids, |
| 18846 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18847 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18848 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18849 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18850 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18851 | .init_hook = alc663_mode5_inithook, |
| 18852 | }, |
| 18853 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18854 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18855 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18856 | .init_verbs = { alc662_init_verbs, |
| 18857 | alc663_two_hp_amic_m2_init_verbs }, |
| 18858 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18859 | .hp_nid = 0x03, |
| 18860 | .dac_nids = alc662_dac_nids, |
| 18861 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18862 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18863 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18864 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18865 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18866 | .init_hook = alc663_mode6_inithook, |
| 18867 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18868 | [ALC663_ASUS_MODE7] = { |
| 18869 | .mixers = { alc663_mode7_mixer }, |
| 18870 | .cap_mixer = alc662_auto_capture_mixer, |
| 18871 | .init_verbs = { alc662_init_verbs, |
| 18872 | alc663_mode7_init_verbs }, |
| 18873 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18874 | .hp_nid = 0x03, |
| 18875 | .dac_nids = alc662_dac_nids, |
| 18876 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18877 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18878 | .channel_mode = alc662_3ST_2ch_modes, |
| 18879 | .unsol_event = alc663_mode7_unsol_event, |
| 18880 | .setup = alc663_mode7_setup, |
| 18881 | .init_hook = alc663_mode7_inithook, |
| 18882 | }, |
| 18883 | [ALC663_ASUS_MODE8] = { |
| 18884 | .mixers = { alc663_mode8_mixer }, |
| 18885 | .cap_mixer = alc662_auto_capture_mixer, |
| 18886 | .init_verbs = { alc662_init_verbs, |
| 18887 | alc663_mode8_init_verbs }, |
| 18888 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18889 | .hp_nid = 0x03, |
| 18890 | .dac_nids = alc662_dac_nids, |
| 18891 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18892 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18893 | .channel_mode = alc662_3ST_2ch_modes, |
| 18894 | .unsol_event = alc663_mode8_unsol_event, |
| 18895 | .setup = alc663_mode8_setup, |
| 18896 | .init_hook = alc663_mode8_inithook, |
| 18897 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18898 | [ALC272_DELL] = { |
| 18899 | .mixers = { alc663_m51va_mixer }, |
| 18900 | .cap_mixer = alc272_auto_capture_mixer, |
| 18901 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18902 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18903 | .dac_nids = alc662_dac_nids, |
| 18904 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18905 | .adc_nids = alc272_adc_nids, |
| 18906 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18907 | .capsrc_nids = alc272_capsrc_nids, |
| 18908 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18909 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18910 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18911 | .init_hook = alc663_m51va_inithook, |
| 18912 | }, |
| 18913 | [ALC272_DELL_ZM1] = { |
| 18914 | .mixers = { alc663_m51va_mixer }, |
| 18915 | .cap_mixer = alc662_auto_capture_mixer, |
| 18916 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18917 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18918 | .dac_nids = alc662_dac_nids, |
| 18919 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18920 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18921 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18922 | .capsrc_nids = alc662_capsrc_nids, |
| 18923 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18924 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18925 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18926 | .init_hook = alc663_m51va_inithook, |
| 18927 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18928 | [ALC272_SAMSUNG_NC10] = { |
| 18929 | .mixers = { alc272_nc10_mixer }, |
| 18930 | .init_verbs = { alc662_init_verbs, |
| 18931 | alc663_21jd_amic_init_verbs }, |
| 18932 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18933 | .dac_nids = alc272_dac_nids, |
| 18934 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18935 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18936 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18937 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18938 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18939 | .init_hook = alc663_mode4_inithook, |
| 18940 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18941 | }; |
| 18942 | |
| 18943 | |
| 18944 | /* |
| 18945 | * BIOS auto configuration |
| 18946 | */ |
| 18947 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18948 | /* convert from MIX nid to DAC */ |
| 18949 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18950 | { |
| 18951 | if (nid == 0x0f) |
| 18952 | return 0x02; |
| 18953 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18954 | return nid - 0x0c + 0x02; |
| 18955 | else |
| 18956 | return 0; |
| 18957 | } |
| 18958 | |
| 18959 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18960 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18961 | hda_nid_t dac) |
| 18962 | { |
| 18963 | hda_nid_t mix[4]; |
| 18964 | int i, num; |
| 18965 | |
| 18966 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18967 | for (i = 0; i < num; i++) { |
| 18968 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18969 | return mix[i]; |
| 18970 | } |
| 18971 | return 0; |
| 18972 | } |
| 18973 | |
| 18974 | /* look for an empty DAC slot */ |
| 18975 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18976 | { |
| 18977 | struct alc_spec *spec = codec->spec; |
| 18978 | hda_nid_t srcs[5]; |
| 18979 | int i, j, num; |
| 18980 | |
| 18981 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18982 | if (num < 0) |
| 18983 | return 0; |
| 18984 | for (i = 0; i < num; i++) { |
| 18985 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18986 | if (!nid) |
| 18987 | continue; |
| 18988 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18989 | if (spec->multiout.dac_nids[j] == nid) |
| 18990 | break; |
| 18991 | if (j >= spec->multiout.num_dacs) |
| 18992 | return nid; |
| 18993 | } |
| 18994 | return 0; |
| 18995 | } |
| 18996 | |
| 18997 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18998 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18999 | const struct auto_pin_cfg *cfg) |
| 19000 | { |
| 19001 | struct alc_spec *spec = codec->spec; |
| 19002 | int i; |
| 19003 | hda_nid_t dac; |
| 19004 | |
| 19005 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19006 | for (i = 0; i < cfg->line_outs; i++) { |
| 19007 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19008 | if (!dac) |
| 19009 | continue; |
| 19010 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19011 | } |
| 19012 | return 0; |
| 19013 | } |
| 19014 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19015 | 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] | 19016 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19017 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19018 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19019 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19020 | } |
| 19021 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19022 | 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] | 19023 | hda_nid_t nid, unsigned int chs) |
| 19024 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19025 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19026 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19027 | } |
| 19028 | |
| 19029 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19030 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19031 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19032 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19033 | |
| 19034 | /* add playback controls from the parsed DAC table */ |
| 19035 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19036 | const struct auto_pin_cfg *cfg) |
| 19037 | { |
| 19038 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19039 | static const char *chname[4] = { |
| 19040 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19041 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19042 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19043 | int i, err; |
| 19044 | |
| 19045 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19046 | nid = spec->multiout.dac_nids[i]; |
| 19047 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19048 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19049 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19050 | if (!mix) |
| 19051 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19052 | if (i == 2) { |
| 19053 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19054 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19055 | if (err < 0) |
| 19056 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19057 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19058 | if (err < 0) |
| 19059 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19060 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19061 | if (err < 0) |
| 19062 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19063 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19064 | if (err < 0) |
| 19065 | return err; |
| 19066 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19067 | const char *pfx; |
| 19068 | if (cfg->line_outs == 1 && |
| 19069 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19070 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19071 | pfx = "Speaker"; |
| 19072 | else |
| 19073 | pfx = "PCM"; |
| 19074 | } else |
| 19075 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19076 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19077 | if (err < 0) |
| 19078 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 19079 | if (cfg->line_outs == 1 && |
| 19080 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19081 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19082 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19083 | if (err < 0) |
| 19084 | return err; |
| 19085 | } |
| 19086 | } |
| 19087 | return 0; |
| 19088 | } |
| 19089 | |
| 19090 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19091 | /* return DAC nid if any new DAC is assigned */ |
| 19092 | 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] | 19093 | const char *pfx) |
| 19094 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19095 | struct alc_spec *spec = codec->spec; |
| 19096 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19097 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19098 | |
| 19099 | if (!pin) |
| 19100 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19101 | nid = alc662_look_for_dac(codec, pin); |
| 19102 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19103 | /* the corresponding DAC is already occupied */ |
| 19104 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19105 | return 0; /* no way */ |
| 19106 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19107 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19108 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19109 | } |
| 19110 | |
| 19111 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19112 | if (!mix) |
| 19113 | return 0; |
| 19114 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19115 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19116 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19117 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19118 | if (err < 0) |
| 19119 | return err; |
| 19120 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19121 | } |
| 19122 | |
| 19123 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19124 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19125 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19126 | |
| 19127 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19128 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19129 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19130 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19131 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19132 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19133 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19134 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19135 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19136 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19137 | if (num <= 1) |
| 19138 | return; |
| 19139 | for (i = 0; i < num; i++) { |
| 19140 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19141 | continue; |
| 19142 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19143 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19144 | } |
| 19145 | } |
| 19146 | |
| 19147 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19148 | { |
| 19149 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19150 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19151 | int i; |
| 19152 | |
| 19153 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19154 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19155 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19156 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19157 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19158 | } |
| 19159 | } |
| 19160 | |
| 19161 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19162 | { |
| 19163 | struct alc_spec *spec = codec->spec; |
| 19164 | hda_nid_t pin; |
| 19165 | |
| 19166 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19167 | if (pin) |
| 19168 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19169 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19170 | pin = spec->autocfg.speaker_pins[0]; |
| 19171 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19172 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19173 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19174 | } |
| 19175 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19176 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19177 | |
| 19178 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19179 | { |
| 19180 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19181 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19182 | int i; |
| 19183 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19184 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19185 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19186 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19187 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19188 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19189 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19190 | snd_hda_codec_write(codec, nid, 0, |
| 19191 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19192 | AMP_OUT_MUTE); |
| 19193 | } |
| 19194 | } |
| 19195 | } |
| 19196 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19197 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19198 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19199 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19200 | { |
| 19201 | struct alc_spec *spec = codec->spec; |
| 19202 | int err; |
| 19203 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19204 | |
| 19205 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19206 | alc662_ignore); |
| 19207 | if (err < 0) |
| 19208 | return err; |
| 19209 | if (!spec->autocfg.line_outs) |
| 19210 | return 0; /* can't find valid BIOS pin config */ |
| 19211 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19212 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19213 | if (err < 0) |
| 19214 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19215 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19216 | if (err < 0) |
| 19217 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19218 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19219 | spec->autocfg.speaker_pins[0], |
| 19220 | "Speaker"); |
| 19221 | if (err < 0) |
| 19222 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19223 | if (err) |
| 19224 | spec->multiout.extra_out_nid[0] = err; |
| 19225 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19226 | "Headphone"); |
| 19227 | if (err < 0) |
| 19228 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19229 | if (err) |
| 19230 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19231 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19232 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19233 | return err; |
| 19234 | |
| 19235 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19236 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19237 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19238 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19239 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19240 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19241 | |
| 19242 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19243 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19244 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19245 | add_verb(spec, alc662_init_verbs); |
| 19246 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19247 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19248 | add_verb(spec, alc663_init_verbs); |
| 19249 | |
| 19250 | if (codec->vendor_id == 0x10ec0272) |
| 19251 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19252 | |
| 19253 | err = alc_auto_add_mic_boost(codec); |
| 19254 | if (err < 0) |
| 19255 | return err; |
| 19256 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19257 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19258 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19259 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19260 | else |
| 19261 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19262 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19263 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19264 | } |
| 19265 | |
| 19266 | /* additional initialization for auto-configuration model */ |
| 19267 | static void alc662_auto_init(struct hda_codec *codec) |
| 19268 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19269 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19270 | alc662_auto_init_multi_out(codec); |
| 19271 | alc662_auto_init_hp_out(codec); |
| 19272 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19273 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19274 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19275 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19276 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19277 | } |
| 19278 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19279 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19280 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19281 | ALC662_FIXUP_IDEAPAD, |
| 19282 | }; |
| 19283 | |
| 19284 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19285 | [ALC662_FIXUP_ASPIRE] = { |
| 19286 | .pins = (const struct alc_pincfg[]) { |
| 19287 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19288 | { } |
| 19289 | } |
| 19290 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19291 | [ALC662_FIXUP_IDEAPAD] = { |
| 19292 | .pins = (const struct alc_pincfg[]) { |
| 19293 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19294 | { } |
| 19295 | } |
| 19296 | }, |
| 19297 | }; |
| 19298 | |
| 19299 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19300 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame^] | 19301 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19302 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19303 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19304 | {} |
| 19305 | }; |
| 19306 | |
| 19307 | |
| 19308 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19309 | static int patch_alc662(struct hda_codec *codec) |
| 19310 | { |
| 19311 | struct alc_spec *spec; |
| 19312 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19313 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19314 | |
| 19315 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19316 | if (!spec) |
| 19317 | return -ENOMEM; |
| 19318 | |
| 19319 | codec->spec = spec; |
| 19320 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19321 | alc_auto_parse_customize_define(codec); |
| 19322 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19323 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19324 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19325 | coef = alc_read_coef_idx(codec, 0); |
| 19326 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19327 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19328 | else if (coef & (1 << 14) && |
| 19329 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19330 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19331 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19332 | else if (coef == 0x4011) |
| 19333 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19334 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19335 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19336 | alc662_models, |
| 19337 | alc662_cfg_tbl); |
| 19338 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19339 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19340 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19341 | board_config = ALC662_AUTO; |
| 19342 | } |
| 19343 | |
| 19344 | if (board_config == ALC662_AUTO) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19345 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19346 | /* automatic parse from the BIOS config */ |
| 19347 | err = alc662_parse_auto_config(codec); |
| 19348 | if (err < 0) { |
| 19349 | alc_free(codec); |
| 19350 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19351 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19352 | printk(KERN_INFO |
| 19353 | "hda_codec: Cannot set up configuration " |
| 19354 | "from BIOS. Using base mode...\n"); |
| 19355 | board_config = ALC662_3ST_2ch_DIG; |
| 19356 | } |
| 19357 | } |
| 19358 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19359 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19360 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19361 | if (err < 0) { |
| 19362 | alc_free(codec); |
| 19363 | return err; |
| 19364 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19365 | } |
| 19366 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19367 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19368 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19369 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19370 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19371 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19372 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19373 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19374 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19375 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19376 | if (!spec->adc_nids) { |
| 19377 | spec->adc_nids = alc662_adc_nids; |
| 19378 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19379 | } |
| 19380 | if (!spec->capsrc_nids) |
| 19381 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19382 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19383 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19384 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19385 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19386 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19387 | switch (codec->vendor_id) { |
| 19388 | case 0x10ec0662: |
| 19389 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19390 | break; |
| 19391 | case 0x10ec0272: |
| 19392 | case 0x10ec0663: |
| 19393 | case 0x10ec0665: |
| 19394 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19395 | break; |
| 19396 | case 0x10ec0273: |
| 19397 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19398 | break; |
| 19399 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19400 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19401 | spec->vmaster_nid = 0x02; |
| 19402 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19403 | codec->patch_ops = alc_patch_ops; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19404 | if (board_config == ALC662_AUTO) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19405 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19406 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
| 19407 | } |
| 19408 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19409 | alc_init_jacks(codec); |
| 19410 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19411 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19412 | if (!spec->loopback.amplist) |
| 19413 | spec->loopback.amplist = alc662_loopbacks; |
| 19414 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19415 | |
| 19416 | return 0; |
| 19417 | } |
| 19418 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19419 | static int patch_alc888(struct hda_codec *codec) |
| 19420 | { |
| 19421 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19422 | kfree(codec->chip_name); |
| 19423 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19424 | if (!codec->chip_name) { |
| 19425 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19426 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19427 | } |
| 19428 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19429 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19430 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19431 | } |
| 19432 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19433 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19434 | * ALC680 support |
| 19435 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19436 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19437 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19438 | #define alc680_modes alc260_modes |
| 19439 | |
| 19440 | static hda_nid_t alc680_dac_nids[3] = { |
| 19441 | /* Lout1, Lout2, hp */ |
| 19442 | 0x02, 0x03, 0x04 |
| 19443 | }; |
| 19444 | |
| 19445 | static hda_nid_t alc680_adc_nids[3] = { |
| 19446 | /* ADC0-2 */ |
| 19447 | /* DMIC, MIC, Line-in*/ |
| 19448 | 0x07, 0x08, 0x09 |
| 19449 | }; |
| 19450 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19451 | /* |
| 19452 | * Analog capture ADC cgange |
| 19453 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19454 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19455 | { |
| 19456 | struct alc_spec *spec = codec->spec; |
| 19457 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19458 | int pin_found = 0; |
| 19459 | int type_found = AUTO_PIN_LAST; |
| 19460 | hda_nid_t nid; |
| 19461 | int i; |
| 19462 | |
| 19463 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19464 | nid = cfg->inputs[i].pin; |
| 19465 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19466 | AC_PINCAP_PRES_DETECT)) |
| 19467 | continue; |
| 19468 | if (snd_hda_jack_detect(codec, nid)) { |
| 19469 | if (cfg->inputs[i].type < type_found) { |
| 19470 | type_found = cfg->inputs[i].type; |
| 19471 | pin_found = nid; |
| 19472 | } |
| 19473 | } |
| 19474 | } |
| 19475 | |
| 19476 | nid = 0x07; |
| 19477 | if (pin_found) |
| 19478 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19479 | |
| 19480 | if (nid != spec->cur_adc) |
| 19481 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19482 | spec->cur_adc = nid; |
| 19483 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19484 | spec->cur_adc_format); |
| 19485 | } |
| 19486 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19487 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19488 | struct hda_codec *codec, |
| 19489 | unsigned int stream_tag, |
| 19490 | unsigned int format, |
| 19491 | struct snd_pcm_substream *substream) |
| 19492 | { |
| 19493 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19494 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19495 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19496 | spec->cur_adc_stream_tag = stream_tag; |
| 19497 | spec->cur_adc_format = format; |
| 19498 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19499 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19500 | return 0; |
| 19501 | } |
| 19502 | |
| 19503 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19504 | struct hda_codec *codec, |
| 19505 | struct snd_pcm_substream *substream) |
| 19506 | { |
| 19507 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19508 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19509 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19510 | return 0; |
| 19511 | } |
| 19512 | |
| 19513 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19514 | .substreams = 1, /* can be overridden */ |
| 19515 | .channels_min = 2, |
| 19516 | .channels_max = 2, |
| 19517 | /* NID is set in alc_build_pcms */ |
| 19518 | .ops = { |
| 19519 | .prepare = alc680_capture_pcm_prepare, |
| 19520 | .cleanup = alc680_capture_pcm_cleanup |
| 19521 | }, |
| 19522 | }; |
| 19523 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19524 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19525 | /* output mixer control */ |
| 19526 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19527 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19528 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19529 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19530 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19531 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19532 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19533 | { } |
| 19534 | }; |
| 19535 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19536 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19537 | .ops = &snd_hda_bind_vol, |
| 19538 | .values = { |
| 19539 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19540 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19541 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19542 | 0 |
| 19543 | }, |
| 19544 | }; |
| 19545 | |
| 19546 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19547 | .ops = &snd_hda_bind_sw, |
| 19548 | .values = { |
| 19549 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19550 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19551 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19552 | 0 |
| 19553 | }, |
| 19554 | }; |
| 19555 | |
| 19556 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19557 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19558 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19559 | { } /* end */ |
| 19560 | }; |
| 19561 | |
| 19562 | /* |
| 19563 | * generic initialization of ADC, input mixers and output mixers |
| 19564 | */ |
| 19565 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19566 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19567 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19568 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19569 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19570 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19571 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19572 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19573 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19574 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19575 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19576 | |
| 19577 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19578 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19579 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19580 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19581 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19582 | |
| 19583 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19584 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19585 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19586 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19587 | { } |
| 19588 | }; |
| 19589 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19590 | /* toggle speaker-output according to the hp-jack state */ |
| 19591 | static void alc680_base_setup(struct hda_codec *codec) |
| 19592 | { |
| 19593 | struct alc_spec *spec = codec->spec; |
| 19594 | |
| 19595 | spec->autocfg.hp_pins[0] = 0x16; |
| 19596 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19597 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19598 | spec->autocfg.num_inputs = 2; |
| 19599 | spec->autocfg.inputs[0].pin = 0x18; |
| 19600 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19601 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19602 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19603 | } |
| 19604 | |
| 19605 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19606 | unsigned int res) |
| 19607 | { |
| 19608 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19609 | alc_automute_amp(codec); |
| 19610 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19611 | alc680_rec_autoswitch(codec); |
| 19612 | } |
| 19613 | |
| 19614 | static void alc680_inithook(struct hda_codec *codec) |
| 19615 | { |
| 19616 | alc_automute_amp(codec); |
| 19617 | alc680_rec_autoswitch(codec); |
| 19618 | } |
| 19619 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19620 | /* create input playback/capture controls for the given pin */ |
| 19621 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19622 | const char *ctlname, int idx) |
| 19623 | { |
| 19624 | hda_nid_t dac; |
| 19625 | int err; |
| 19626 | |
| 19627 | switch (nid) { |
| 19628 | case 0x14: |
| 19629 | dac = 0x02; |
| 19630 | break; |
| 19631 | case 0x15: |
| 19632 | dac = 0x03; |
| 19633 | break; |
| 19634 | case 0x16: |
| 19635 | dac = 0x04; |
| 19636 | break; |
| 19637 | default: |
| 19638 | return 0; |
| 19639 | } |
| 19640 | if (spec->multiout.dac_nids[0] != dac && |
| 19641 | spec->multiout.dac_nids[1] != dac) { |
| 19642 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19643 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19644 | HDA_OUTPUT)); |
| 19645 | if (err < 0) |
| 19646 | return err; |
| 19647 | |
| 19648 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19649 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19650 | |
| 19651 | if (err < 0) |
| 19652 | return err; |
| 19653 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19654 | } |
| 19655 | |
| 19656 | return 0; |
| 19657 | } |
| 19658 | |
| 19659 | /* add playback controls from the parsed DAC table */ |
| 19660 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19661 | const struct auto_pin_cfg *cfg) |
| 19662 | { |
| 19663 | hda_nid_t nid; |
| 19664 | int err; |
| 19665 | |
| 19666 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19667 | |
| 19668 | nid = cfg->line_out_pins[0]; |
| 19669 | if (nid) { |
| 19670 | const char *name; |
| 19671 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19672 | name = "Speaker"; |
| 19673 | else |
| 19674 | name = "Front"; |
| 19675 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19676 | if (err < 0) |
| 19677 | return err; |
| 19678 | } |
| 19679 | |
| 19680 | nid = cfg->speaker_pins[0]; |
| 19681 | if (nid) { |
| 19682 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19683 | if (err < 0) |
| 19684 | return err; |
| 19685 | } |
| 19686 | nid = cfg->hp_pins[0]; |
| 19687 | if (nid) { |
| 19688 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19689 | if (err < 0) |
| 19690 | return err; |
| 19691 | } |
| 19692 | |
| 19693 | return 0; |
| 19694 | } |
| 19695 | |
| 19696 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19697 | hda_nid_t nid, int pin_type) |
| 19698 | { |
| 19699 | alc_set_pin_output(codec, nid, pin_type); |
| 19700 | } |
| 19701 | |
| 19702 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19703 | { |
| 19704 | struct alc_spec *spec = codec->spec; |
| 19705 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19706 | if (nid) { |
| 19707 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19708 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19709 | } |
| 19710 | } |
| 19711 | |
| 19712 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19713 | { |
| 19714 | struct alc_spec *spec = codec->spec; |
| 19715 | hda_nid_t pin; |
| 19716 | |
| 19717 | pin = spec->autocfg.hp_pins[0]; |
| 19718 | if (pin) |
| 19719 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19720 | pin = spec->autocfg.speaker_pins[0]; |
| 19721 | if (pin) |
| 19722 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19723 | } |
| 19724 | |
| 19725 | /* pcm configuration: identical with ALC880 */ |
| 19726 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19727 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19728 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19729 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19730 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19731 | |
| 19732 | /* |
| 19733 | * BIOS auto configuration |
| 19734 | */ |
| 19735 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19736 | { |
| 19737 | struct alc_spec *spec = codec->spec; |
| 19738 | int err; |
| 19739 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19740 | |
| 19741 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19742 | alc680_ignore); |
| 19743 | if (err < 0) |
| 19744 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19745 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19746 | if (!spec->autocfg.line_outs) { |
| 19747 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19748 | spec->multiout.max_channels = 2; |
| 19749 | spec->no_analog = 1; |
| 19750 | goto dig_only; |
| 19751 | } |
| 19752 | return 0; /* can't find valid BIOS pin config */ |
| 19753 | } |
| 19754 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19755 | if (err < 0) |
| 19756 | return err; |
| 19757 | |
| 19758 | spec->multiout.max_channels = 2; |
| 19759 | |
| 19760 | dig_only: |
| 19761 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19762 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19763 | if (spec->kctls.list) |
| 19764 | add_mixer(spec, spec->kctls.list); |
| 19765 | |
| 19766 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19767 | |
| 19768 | err = alc_auto_add_mic_boost(codec); |
| 19769 | if (err < 0) |
| 19770 | return err; |
| 19771 | |
| 19772 | return 1; |
| 19773 | } |
| 19774 | |
| 19775 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19776 | |
| 19777 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19778 | static void alc680_auto_init(struct hda_codec *codec) |
| 19779 | { |
| 19780 | struct alc_spec *spec = codec->spec; |
| 19781 | alc680_auto_init_multi_out(codec); |
| 19782 | alc680_auto_init_hp_out(codec); |
| 19783 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19784 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19785 | if (spec->unsol_event) |
| 19786 | alc_inithook(codec); |
| 19787 | } |
| 19788 | |
| 19789 | /* |
| 19790 | * configuration and preset |
| 19791 | */ |
| 19792 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19793 | [ALC680_BASE] = "base", |
| 19794 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19795 | }; |
| 19796 | |
| 19797 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19798 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19799 | {} |
| 19800 | }; |
| 19801 | |
| 19802 | static struct alc_config_preset alc680_presets[] = { |
| 19803 | [ALC680_BASE] = { |
| 19804 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19805 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19806 | .init_verbs = { alc680_init_verbs }, |
| 19807 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19808 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19809 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19810 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19811 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19812 | .unsol_event = alc680_unsol_event, |
| 19813 | .setup = alc680_base_setup, |
| 19814 | .init_hook = alc680_inithook, |
| 19815 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19816 | }, |
| 19817 | }; |
| 19818 | |
| 19819 | static int patch_alc680(struct hda_codec *codec) |
| 19820 | { |
| 19821 | struct alc_spec *spec; |
| 19822 | int board_config; |
| 19823 | int err; |
| 19824 | |
| 19825 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19826 | if (spec == NULL) |
| 19827 | return -ENOMEM; |
| 19828 | |
| 19829 | codec->spec = spec; |
| 19830 | |
| 19831 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19832 | alc680_models, |
| 19833 | alc680_cfg_tbl); |
| 19834 | |
| 19835 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19836 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19837 | codec->chip_name); |
| 19838 | board_config = ALC680_AUTO; |
| 19839 | } |
| 19840 | |
| 19841 | if (board_config == ALC680_AUTO) { |
| 19842 | /* automatic parse from the BIOS config */ |
| 19843 | err = alc680_parse_auto_config(codec); |
| 19844 | if (err < 0) { |
| 19845 | alc_free(codec); |
| 19846 | return err; |
| 19847 | } else if (!err) { |
| 19848 | printk(KERN_INFO |
| 19849 | "hda_codec: Cannot set up configuration " |
| 19850 | "from BIOS. Using base mode...\n"); |
| 19851 | board_config = ALC680_BASE; |
| 19852 | } |
| 19853 | } |
| 19854 | |
| 19855 | if (board_config != ALC680_AUTO) |
| 19856 | setup_preset(codec, &alc680_presets[board_config]); |
| 19857 | |
| 19858 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19859 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19860 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19861 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19862 | |
| 19863 | if (!spec->adc_nids) { |
| 19864 | spec->adc_nids = alc680_adc_nids; |
| 19865 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19866 | } |
| 19867 | |
| 19868 | if (!spec->cap_mixer) |
| 19869 | set_capture_mixer(codec); |
| 19870 | |
| 19871 | spec->vmaster_nid = 0x02; |
| 19872 | |
| 19873 | codec->patch_ops = alc_patch_ops; |
| 19874 | if (board_config == ALC680_AUTO) |
| 19875 | spec->init_hook = alc680_auto_init; |
| 19876 | |
| 19877 | return 0; |
| 19878 | } |
| 19879 | |
| 19880 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19881 | * patch entries |
| 19882 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19883 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19884 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19885 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19886 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19887 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19888 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19889 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19890 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19891 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19892 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19893 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19894 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19895 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19896 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19897 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19898 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19899 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19900 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19901 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19902 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19903 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19904 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19905 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19906 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19907 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19908 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19909 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19910 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19911 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19912 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19913 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19914 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19915 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19916 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19917 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19918 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19919 | {} /* terminator */ |
| 19920 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19921 | |
| 19922 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19923 | |
| 19924 | MODULE_LICENSE("GPL"); |
| 19925 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19926 | |
| 19927 | static struct hda_codec_preset_list realtek_list = { |
| 19928 | .preset = snd_hda_preset_realtek, |
| 19929 | .owner = THIS_MODULE, |
| 19930 | }; |
| 19931 | |
| 19932 | static int __init patch_realtek_init(void) |
| 19933 | { |
| 19934 | return snd_hda_add_codec_preset(&realtek_list); |
| 19935 | } |
| 19936 | |
| 19937 | static void __exit patch_realtek_exit(void) |
| 19938 | { |
| 19939 | snd_hda_delete_codec_preset(&realtek_list); |
| 19940 | } |
| 19941 | |
| 19942 | module_init(patch_realtek_init) |
| 19943 | module_exit(patch_realtek_exit) |